当前位置: 首页 > news >正文

seo网站优化方案摘要做场景秀的网站

seo网站优化方案摘要,做场景秀的网站,优化营商环境个人心得,谁会在掏宝网上做网站扩展 junit 框架JUnit5最终版本即将来临 #xff08;当前是M4#xff09;#xff0c;我已经开始尝试如何编写扩展了。 在JUnit5中 #xff0c;您没有使用Runners #xff0c; Rules #xff0c; ClassRules等#xff0c;而是只有一个Extension API来实现自己的扩展。 … 扩展 junit 框架 JUnit5最终版本即将来临 当前是M4我已经开始尝试如何编写扩展了。 在JUnit5中 您没有使用Runners Rules ClassRules等而是只有一个Extension API来实现自己的扩展。 JUnit5提供了多个接口来挂钩其生命周期。 例如您可以挂钩到“ 测试实例后处理”以在测试实例上调用自定义初始化方法或者通过“ 参数解析”来在运行时动态解析测试方法参数。 当然到目前为止典型的操作如在执行所有测试之前执行测试之前执行测试之后进行挂接等等可以在http://junit.org/junit5/docs/找到完整列表。 当前/用户指南/extensions-lifecycle-callbacks 但是在每个过程中都在过程的哪一点执行 为了测试它我刚刚创建了一个扩展该扩展实现了所有接口并且每个方法都会打印出谁。 public class LoggerExtension implements TestInstancePostProcessor, ParameterResolver, BeforeAllCallback,BeforeEachCallback, BeforeTestExecutionCallback, AfterEachCallback, AfterTestExecutionCallback, AfterAllCallback,TestExecutionExceptionHandler {Overridepublic void postProcessTestInstance(Object testInstance, ExtensionContext context) throws Exception {System.out.println(Test Instance Post-processing called);}Overridepublic boolean supports(ParameterContext parameterContext, ExtensionContext extensionContext)throws ParameterResolutionException {System.out.println(Parameter Resolver Supports called);return parameterContext.getParameter().getType().equals(String.class);}Overridepublic Object resolve(ParameterContext parameterContext, ExtensionContext extensionContext)throws ParameterResolutionException {System.out.println(Resolver called);return Hello World;}Overridepublic void beforeAll(ContainerExtensionContext context) throws Exception {System.out.println(Before All called context.getTestClass().get());}Overridepublic void beforeEach(TestExtensionContext context) throws Exception {System.out.println(Before Each called);}Overridepublic void beforeTestExecution(TestExtensionContext context) throws Exception {System.out.println(Before Test Execution called);}Overridepublic void afterEach(TestExtensionContext context) throws Exception {System.out.println(After Each called);}Overridepublic void afterTestExecution(TestExtensionContext context) throws Exception {System.out.println(After Test Executon called);}Overridepublic void afterAll(ContainerExtensionContext context) throws Exception {System.out.println(After All called);}Overridepublic void handleTestExecutionException(TestExtensionContext context, Throwable throwable) throws Throwable {System.out.println(Test Execution Exception called);throw throwable;} } 然后我创建了一个包含两个测试的JUnit5测试套件 ExtendWith(LoggerExtension.class) public class AnotherLoggerExtensionTest {Testpublic void test4() {System.out.println(Test 4);}}ExtendWith(LoggerExtension.class) public class LoggerExtensionTest {Testpublic void test1() {System.out.println(Test 1);}Testpublic void test2(String msg) {System.out.println(Test 2 msg);}Testpublic void test3() {System.out.println(Test 3);throw new IllegalArgumentException();}}RunWith(JUnitPlatform.class) SelectClasses({LoggerExtensionTest.class, AnotherLoggerExtensionTest.class}) public class LoggerExtensionTestSuite { } 那么在执行此套件之后输出是什么 让我们来看看它。 请注意出于可读性考虑我在终端输出上添加了一些标注。 Before All called class AnotherLoggerExtensionTest Test Instance Post-processing called Before Each called Before Test Execution called Test 4 After Test Execution called After Each called After All called// 1Before All called class LoggerExtensionTest Test Instance Post-processing called Before Each called Before Test Execution called Test 1 After Test Execution called After Each called// 2Test Instance Post-processing called Before Each called Before Test Execution called Parameter Resolver Supports called Resolver called Test 2 Hello World After Test Execution called After Each called// 3Test Instance Post-processing called Before Each called Before Test Execution called Test 3 Test Execution Exception called After Test Execution called After Each called// 4After All called 1运行它的第一个测试是AnotherLoggerExtensionTest 。 在这种情况下只有一个简单的测试因此扩展的生命周期为BeforeAll Test Instance-Post-Processing Before Each Before Test Execution 然后执行测试本身然后执行所有After回调。 2然后执行LoggerExtensionTest 。 第一次测试不是参数化测试因此不会调用与参数解析有关的事件。 在执行test方法之前将调用测试实例后处理 然后再引发所有事件之前。 最终所有后续事件都将执行测试。 3第二个测试包含需要参数解析。 参数解析器在Before事件之后和执行测试本身之前运行。 4最后一次测试将引发异常。 在执行测试之后但在After事件之前调用Test Execution Exception 。 最后要注意的是 BeforeAll和AfterAll事件是按测试类而不是套件执行的。 本示例中使用的JUnit版本是org.junit.jupiterjunit-jupiter-api5.0.0-M4 翻译自: https://www.javacodegeeks.com/2017/06/lifecycle-junit-5-extension-model.html扩展 junit 框架
http://www.zqtcl.cn/news/937853/

相关文章:

  • 做网站和优化学校asp网站
  • 佛山正规网站建设哪家好合肥专业网站优化价格
  • 华容网站免费ppt模板下载医学类
  • 网站注册申请艺术风格网站
  • 怎么上国外购物网站网站毕业作品代做
  • wordpress 描述字段seo排名技术教程
  • 重庆seo网站建设wordpress评论邮件插件
  • 企业网站模板下载网站模板下载做一个购物商城网站多少钱
  • 网站开发有哪些服务推荐电子商务网站建设
  • 网站交互技术网站框架类型
  • 国内网站建设公司top20对软件开发的理解和认识
  • 一键生成网站前端开发用什么语言
  • pc 网站建设苏州seo网站诊断
  • 江苏盐城建筑公司网站seo专员的工作内容
  • 做网站内容腾讯云wordpress教程
  • 如何建设 linux 网站旅游区网站开发
  • 云南网站设计哪家好wordpress 右边栏
  • 服务器网站部署端口配置网站,商城,app+建设
  • 如何做公司网站优化装修店铺
  • 网站开发中常见的安全漏洞卢松松博客源码 wordpress博客模板
  • 美妆销售网站开发的目的东莞营销网站
  • 企业网站管理系统使用教程域名到期 网站打不开
  • 长春网站建设哪家专业国外免备案域名
  • 网站后台上传图片做难吗网站特效怎么做的
  • 泉州网站优化lamp环境做网站
  • 设计常用网站网站常见程序问题
  • 做网站竟然不知道cms如何添加网站图标
  • 东莞阳光网站官网缘魁上海网站建设
  • 山西孝义网站开发平面设计类网站有哪些
  • 手机版怎么做微电影网站青岛网站设计定制