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

做公众号的模版的网站网站建设公司选择哪家好

做公众号的模版的网站,网站建设公司选择哪家好,劳务公司找项目平台,百度上做优化第2关#xff1a;Junit注解 任务描述 给出一个带有注解的Junit代码及其代码打印输出#xff0c;要求学员修改注解位置#xff0c;让输出结果变为逆序。 相关知识 Junit注解 Java注解#xff08;(Annotation#xff09;的使用方法是 注解名 。借助注解Junit注解 任务描述 给出一个带有注解的Junit代码及其代码打印输出要求学员修改注解位置让输出结果变为逆序。 相关知识 Junit注解 Java注解(Annotation的使用方法是 注解名 。借助注解我们可以在编程中通过简单的注解来实现一些功能。在junit中常用的注解有 Test、Ignore、BeforeClass、AfterClass、Before、After 下表列出了这些注释的概括 具体解释如下 1、Test表明此方法为测试方法。 2、Before用此注解修饰的方法在每个test方法运行前执行 3、BeforeClass用此注解修饰的方法将在所有方法运行前被执行是一个static方法只执行一次。 4、After用此注解修饰的方法在每个test方法运行后执行 5、AfterClass用此注解修饰的方法将在所有方法运行后被执行也是一个static方法只执行一次。 6、Ignore用此注解修饰的方法会被Junit忽略。 代码示例 这里新建一个JunitAnnotation.java把上面所讲的注解全部加到某个测试函数之前这些注解的作用一目了然 package com.trustie.junittest;import static org.junit.Assert.*;import java.util.*;import org.junit.*;public class AnnotationsTest {private ArrayList testList;BeforeClasspublic static void onceExecutedBeforeAll() {System.out.println(BeforeClass: onceExecutedBeforeAll);}Beforepublic void executedBeforeEach() {testList new ArrayList();System.out.println(Before: executedBeforeEach);}AfterClasspublic static void onceExecutedAfterAll() {System.out.println(AfterClass: onceExecutedAfterAll);}Afterpublic void executedAfterEach() {testList.clear();System.out.println(After: executedAfterEach);}Testpublic void EmptyCollection() {assertTrue(testList.isEmpty());System.out.println(Test: EmptyArrayList);}Testpublic void OneItemCollection() {testList.add(oneItem);assertEquals(1, testList.size());System.out.println(Test: OneItemArrayList);}Ignorepublic void executionIgnored() {System.out.println(Ignore: This execution is ignored);}} 如果我们运行上面的测试控制台输出将是下面 BeforeClass: onceExecutedBeforeAllBefore: executedBeforeEachTest: EmptyArrayListAfter: executedAfterEachBefore: executedBeforeEachTest: OneItemArrayListAfter: executedAfterEachAfterClass: onceExecutedAfterAll 编程要求 本关的编程任务是在JunitAnnotation.java中修改测试函数对应的注解使得原代码输出结果变为逆序。 本关涉及的代码文件JunitAnnotation.java的代码如下: package step2;import org.junit.After;import org.junit.AfterClass;import org.junit.Before;import org.junit.BeforeClass;import org.junit.Ignore;import org.junit.Test;public class JunitAnnotation {/**以下Junit测试程序的输出结果为*in before class*in before*in test*in after*in after class*请修改下面Begin/End内各个测试函数的注解使输出结果逆序*//***********************Begin**************************///execute before classBeforeClasspublic static void beforeClass() {System.out.println(in before class);}//execute after classAfterClasspublic static void afterClass() {System.out.println(in after class);}//execute before testBeforepublic void before() {System.out.println(in before);}//execute after testAfterpublic void after() {System.out.println(in after);}//test caseTestpublic void test() {System.out.println(in test);}/************************End***************************/} 评测说明 本关卡的测试文件是TestRunner.java该文件进行了函数封装且学员不可见用于验证学员的Junit测试代码是否正确。 具体测试过程如下 1.平台自动编译生成TestRunner.exe; 2.平台运行TestRunner.exe 3.获取TestRunner.exe输出并将其输出与预期输出对比:如果一致则测试通过否则测试失败。 预期输入: 预期输出: in after classin afterin testin beforein before classtrue 友情提示 1.请不要直接println最终输出否则平台发现此类情况后将一律扣掉本关经验值并且追加处罚措施。 2.学员答题时请尽量手敲代码请勿从实训讲解代码片段中复制代码段粘贴到答题区域作答复制的内容会保留一些格式和字符导致编译失败。 开始你的任务吧祝你成功! 代码如下 package step2;import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test;public class JunitAnnotation {/**以下Junit测试程序的输出结果为*in before class*in before*in test*in after*in after class*请修改下面Begin/End内各个测试函数的注解使输出结果逆序*//***********************Begin**************************/BeforeClasspublic static void afterClass() {System.out.println(in after class);}Beforepublic void after() {System.out.println(in after);}Afterpublic void before() {System.out.println(in before);}AfterClasspublic static void beforeClass() {System.out.println(in before class);}Testpublic void test() {System.out.println(in test);}/************************End***************************/ }
http://www.hkea.cn/news/14317247/

相关文章:

  • 高端网站建设 南京东营网站制作方案
  • 重庆网站建站价格东营 微信网站建设
  • 网站积分程序怎么建设江苏建设招标网站
  • 官网建站合作模版个人做论坛网站要什么证件
  • 经典网站建设案例wordpress外贸模板
  • 青岛建网站人知名室内设计网站
  • 网站建设 秦皇岛公司哪家好电商网页设计教程
  • 做企业网站建设公司哪家好乐潍清网站额建设
  • 网站怎么做下载链接无锡网络推广公司
  • 香河做网站湖南seo推广方法
  • net网站开发 兼职黄骅市属于
  • 本地顺德网站建设找企业名录的网站
  • php网站模板下载财务软件哪个最好用最简单
  • 建立网站 要怎么做做网站的属于什么岗位
  • 潍坊网站建设优化想找个人建网站
  • 做一静态网站 多少钱浙江1万家企业
  • 网站运营面试问题怎么成立自己的网站
  • 大学生可以做的网站网络营销怎么做有特色
  • 网站建设合同示范文本网页微信注册新号怎么注册
  • 江苏外贸网站建设腾讯云服务器用什么软件做网站
  • 红旗渠建设集团网站浙江省建设信息港岗位证书查询
  • 网站 项目 需求成都视觉设计公司
  • 怎么做网站小图标公司不需要做网站了
  • 北京网站设计有名 乐云践新简单做网站的价格
  • 辽宁住房和建设厅网站首页黑龙江省建设工程招标网站
  • 建设银行网站电子支付在哪里net淘宝网站开发的例子
  • 做磨毛布内销哪个网站比较好什么网站做首页
  • 如何建设微网站微信运营专员是什么工作
  • 曼斯特(北京)网站建设公司网页回合制游戏排行榜
  • 怎样做网站后台深圳app定制开发外包公司