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

中学校园网站建设方案html做音乐网站

中学校园网站建设方案,html做音乐网站,外贸公司英文,关于幼儿建设网站ppt模板下载在idea环境下#xff0c;可以用过插件的方式自动生成juint模板代码。不过具体要需要自己手动编写。 1、安装插件 打开idea#xff0c;file–settings–plugins#xff0c;搜索和安装插件#xff08;JunitGenerator V2.0和JUnit#xff09;#xff0c;安装后#xff0c;后…在idea环境下可以用过插件的方式自动生成juint模板代码。不过具体要需要自己手动编写。 1、安装插件 打开ideafile–settings–plugins搜索和安装插件JunitGenerator V2.0和JUnit安装后后面的两个勾选都必须选中。 我仅安装JunitGenerator V2.0插件安装成功后发现两个都存在了。JunitGenerator V2.0为代码生成必要的JUnit为运行juint单元测试必要的。 2、配置junit 安装完成插件后需要重启idea。之后打开settings–other settings可以看到如下的插件配置页面 (1)、完成如下图的配置 Output Path配置为 ${SOURCEPATH}/../../test/java/${PACKAGE}/${FILENAME}2、切换到juint4模板页面进行如下修改 附完整我的junit4模板配置 ######################################################################################## ## ## Available variables: ## $entryList.methodList - List of method composites ## $entryList.privateMethodList - List of private method composites ## $entryList.fieldList - ArrayList of class scope field names ## $entryList.className - class name ## $entryList.packageName - package name ## $today - Todays date in MM/dd/yyyy format ## ## MethodComposite variables: ## $method.name - Method Name ## $method.signature - Full method signature in String form ## $method.reflectionCode - list of strings representing commented out reflection code to access method (Private Methods) ## $method.paramNames - List of Strings representing the methods parameters names ## $method.paramClasses - List of Strings representing the methods parameters classes ## ## You can configure the output class name using testClass variable below. ## Here are some examples: ## Test${entry.ClassName} - will produce TestSomeClass ## ${entry.className}Test - will produce SomeClassTest ## ######################################################################################## ## #macro (cap $strIn)$strIn.valueOf($strIn.charAt(0)).toUpperCase()$strIn.substring(1)#end ## Iterate through the list and generate testcase for every entry. #foreach ($entry in $entryList) #set( $testClass${entry.className}Test) ## package $entry.packageName; import org.junit.Test; import org.junit.Before; import org.junit.After; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner;/** * ${entry.className} Tester. * * author weisian * since pre$today/pre * version 1.0 */ RunWith(SpringRunner.class) SpringBootTest(classes {PlatformApplication.class}, webEnvironment SpringBootTest.WebEnvironment.RANDOM_PORT) public class $testClass { Before public void before() throws Exception { } After public void after() throws Exception { } #foreach($method in $entry.methodList) /** * * Method: $method.signature * */ Test public void test#cap(${method.name})() throws Exception { //TODO: Test goes here... } #end #foreach($method in $entry.privateMethodList) /** * * Method: $method.signature * */ Test public void test#cap(${method.name})() throws Exception { //TODO: Test goes here... #foreach($string in $method.reflectionCode) $string #end } #end } #end3、代码引入junit的必要pom !-- springboot Test --dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-test/artifactIdscopetest/scope/dependency!-- https://mvnrepository.com/artifact/junit/junit --dependencygroupIdjunit/groupIdartifactIdjunit/artifactIdversion4.12/versionscopetest/scope/dependency4、生成需要的junitTest文件 打开需要生成测试的源文件在页面上右键选择generate选择junit Test选择JUnit4 可以看到自动生成*Test.java文件文件路径和源文件一致仅挂载在test资源下 这里看到报错是因为启动类我们没有在junit 4模板中导入包如果模板配置加上导入启动类包的代码就不会报错。模板未配置的话也可以自己手动导入包 5、如果是第一次生成test目录的化需要修改目录属性 1、在src目录上右键按照下图配置成Sources Root 2、在test目录上右键按照下图配置成Test Sources Root 6、模板生成的会是源代码中所有定义方法的测试方法都为空可以自己调整代码进行数据模拟测试。 一次启动会运行所有的测试方法每一个测试方法都会先执行一下before执行完成之后在执行一次after。 如下实例 package XX.goods.controller;import com.alibaba.fastjson.JSON; import com.XX.PlatformApplication; import com.XX.model.ResponseModel; import com.XX.goods.api.GoodsRepairService; import com.XX.goods.model.GoodsRepair; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner;import org.springframework.beans.factory.annotation.Autowired;/*** GoodsRepairController Tester.** author weisian* version 1.0* since pre05/19/2023/pre*/ RunWith(SpringRunner.class) SpringBootTest(classes {PlatformApplication.class}, webEnvironment SpringBootTest.WebEnvironment.RANDOM_PORT)public class GoodsRepairControllerTest {Autowiredprivate GoodsRepairService goodsRepairService;Autowiredprivate GoodsRepairController goodsRepairController;Beforepublic void before() throws Exception {System.out.println(before);}Afterpublic void after() throws Exception {System.out.println(after);}Testpublic void testAddSubmit() throws Exception {System.out.println(testAddSubmit);GoodsRepair byId goodsRepairService.getById(1b6ea48be18e5576aef49f8f60653888);System.out.println(11 JSON.toJSONString(byId));}Testpublic void testFindMyRepairList() throws Exception {System.out.println(testFindMyRepairList);ResponseModel byId goodsRepairController.getById(, null, null);System.out.println(22 JSON.toJSONString(byId));}} 7、右键执行单元测试类查看效果 执行 效果 上图是全部的日志也可以点击单个方法查看单个方法的运行日志 总结 idea下需要先安装好插件重启idea后配置模板修改源代码pom后指定源代码文件生成对应的test工具类如果是第一次生成需要修改目录属性。之后就可以根据我们需要编写测试代码了。 运行juint工具类实际上相当于启动容器后在调用指定类的所有测试方法。关于注入service时一定要是Autowired从容器中获取不然在before中new serviceImpl只能引用成功service本身的方法如果service还引用其他service就无法满足。 学海无涯苦作舟
http://www.hkea.cn/news/14337621/

相关文章:

  • 滨州网站建设报价dedecms网站地图制作
  • 外国网站 dns解析失败南京制作网站公司哪家好
  • 如何做网站安全扫描门户网站是什么意思啊
  • 网站引导页设计tp5手机网站开发
  • 如何做网站的seo优化网站网页制作公司
  • 如何做网站流量php网站开发实例教程书
  • 国内网站赔率网站怎么做
  • 耐克网站建设策划方案淘宝排名查询工具
  • 网站上传服务器后台上传资料出错家具网站首页模板
  • 做网站的设计流程h5手机网站开发
  • 做淘宝客网站 首选霍常亮个人简历制作视频教程
  • 建网站需要什么语言wordpress post表
  • 网站备案技巧免费访问国外网站的应用
  • 做网站是用ps还是ai汝州市住房和城乡建设局网站
  • 南阳建设网站哪家好做字体网站
  • 两学一做知识竞答网站网站产品页面什么时候做
  • 网站建设和源代码问题wordpress个性化
  • 化妆品网站建设佛山网站优化指导
  • 如何做网站跳转登入英文手表网站
  • 建设教育工程网站电商平台运营策略
  • wordpress地址 站点地址网站建设与网页设计从入门到精通 pdf
  • 搭建网站的价格长春专业做网站的公司有哪些
  • 度假区网站建设方案企业网站建设费用入哪个科目
  • 菠菜网站开发建设个网站需要什么
  • 十个app制作网站大宗商品现货交易平台
  • 八宝山做网站公司项目网络的关键路径
  • 做网站现在可以挣钱吗作文网站投稿
  • 做网站php软件苏州外贸营销网站建设
  • wordpress 增加站长统计企业网站功能模块设计
  • 服务器地址在哪里看百度排名优化咨询电话