Maven单元测试
// SKU码:系列前3位+6位年月日+3位序号(自动生产,取数据库中当天最大的,没有就赋值位001) // 订单编号:BRD+6位年月日+5位序号
//
// 退单号:BRT+6位年月日+3位序号 @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:/spring/applicationContext-dao.xml")
public class CodeGenerateServiceImplTest { private final Logger logger = Logger.getLogger(this.getClass());
@Autowired
private CodeGenerateMapper codeGenerateMapper; @Test
public void insertOne() throws Exception {
BMUtil bmUtil = new BMUtil();
//参数s
String firstCode = "BRG";
String generateType = bmUtil.BRG;
// String generateType = "BRG";
int indexSize = 3;
//参数e
String zero = "";
for (int i = 0; i < indexSize; i++) {
zero += "0";
}
Date dt = new Date();
SimpleDateFormat matter1 = new SimpleDateFormat("yyyyMMdd");
String secondCode = matter1.format(dt); // 当天的日期六位格式化 CodeGenerate codeGenerate = new CodeGenerate();
codeGenerate.setFirstCode(firstCode);
codeGenerate.setSecondCode(secondCode);
codeGenerate.setGenerateType(generateType); String maxLastCode = codeGenerateMapper.getMaxLastCode(codeGenerate);
String newLastCode = "";
if (maxLastCode != "" && maxLastCode != null) {
int maxLastCodeNum = Integer.valueOf(maxLastCode);
maxLastCodeNum++;
Format f = new DecimalFormat(zero);
newLastCode = f.format(maxLastCodeNum);
System.out.println(newLastCode); } else {
int num = 1;
Format ff = new DecimalFormat(zero);
newLastCode = ff.format(num);
System.out.println(newLastCode);
}
codeGenerate.setLastCode(newLastCode);
// 插入数据库
int t = codeGenerateMapper.insertOne(codeGenerate); //通过插入后返回的主见,查询编码信息
System.out.println(codeGenerate.getId());
List<CodeGenerate> codeGenerateList = codeGenerateMapper.getCodeGenerateById(codeGenerate.getId());
String bm = codeGenerateList.get(0).getFirstCode() + codeGenerateList.get(0).getSecondCode() + codeGenerateList.get(0).getLastCode();
logger.info(JSON.toJSONStringWithDateFormat(codeGenerateList, "yyyy-MM-dd HH:mm:ss"));
System.out.println(bm);
}
Maven单元测试的更多相关文章
- maven单元测试设置代理
背景 环境需要设置代理才能够访问外部网络,如果只是运行java程序来访问网络,我们可以通过java -jar test.jar -DproxyHost=proxy_ip -DproxyPort=pro ...
- maven 单元测试 ( http://www.cnblogs.com/qinpengming/p/5225380.html )
对junit单元测试的报告:类似这样的结果 ------------------------------------------------------- T E S T S ----------- ...
- junit+maven单元测试
一.概念 junit是一个专门测试的框架 集合maven进行单元测试,可批量测试类中的大量方法是否符合预期 二.作用:单元测试:测试的内容是类中的方法,每一个方法都是独立测试的.方法是测试的基本单位. ...
- maven单元测试报java.lang.IllegalStateException: Failed to load ApplicationContext
报这个异常java.lang.IllegalStateException: Failed to load ApplicationContext的时候,通常是因为applicationContent.x ...
- [转]利用maven的surefire插件实现单元测试与集成测试
原文链接 http://my.oschina.net/dlpinghailinfeng/blog/301136 maven单元测试与集成测试 通过maven的Profile 配置生命周期 通过mave ...
- 工程化管理--maven
mavne模型 可以看出 maven构件都是由插件支撑的 maven的插件位置在:F:\MavenRepository\org\apache\maven\plugins Maven仓库布局 本地仓库 ...
- Maven运行JUnit测试(http://www.360doc.com/content/13/0927/15/7304817_317455642.shtml)
Maven单元测试 分类: maven 2012-05-09 15:17 1986人阅读 评论(1) 收藏 举报 maven测试junit单元测试javarandom 目录(?)[-] maven ...
- Quartz学习——SSMM(Spring+SpringMVC+Mybatis+Mysql)和Quartz集成详解(四)
当任何时候觉你得难受了,其实你的大脑是在进化,当任何时候你觉得轻松,其实都在使用以前的坏习惯. 通过前面的学习,你可能大致了解了Quartz,本篇博文为你打开学习SSMM+Quartz的旅程!欢迎上车 ...
- (转) Quartz学习——SSMM(Spring+SpringMVC+Mybatis+Mysql)和Quartz集成详解(四)
http://blog.csdn.net/u010648555/article/details/60767633 当任何时候觉你得难受了,其实你的大脑是在进化,当任何时候你觉得轻松,其实都在使用以前的 ...
随机推荐
- monkeyrunner之控件ID不存在或重复(转载lynnLi)
我们在用monkeyrunner进行Android自动化时,通过获取坐标点或控件ID进行一系列操作.由于使用坐标点时,屏幕分辨率一旦更改,则代码中用到坐标的地方都要修改,这样导致代码的复用率较低.因此 ...
- Linux关于FTP安全
https://www.cnblogs.com/Hyber/archive/2017/02/04/6362916.htmlhttps://www.cnblogs.com/ichunqiu/p/7300 ...
- 【译】Swift 字符串速查表
[译]Swift 字符串速查表 2015-12-18 10:32 编辑: suiling 分类:Swift 来源:CocoaChina翻译活动 10 5585 Swift字符串 招聘信息: iOS高级 ...
- [CODEVS] 3955 最长严格上升子序列(加强版)
题目描述 Description 给一个数组a1, a2 ... an,找到最长的上升降子序列ab1<ab2< .. <abk,其中b1<b2<..bk. 输出长度即可. ...
- 【转发】【linux】【ftp】CentOS 7.0安装配置Vsftp服务器
adduser -d /var/www/android -g ftp -s /sbin/nologin ftp2 一.配置防火墙,开启FTP服务器需要的端口 CentOS 7.0默认使用的是firew ...
- 什么是php?php的优缺点有哪些?与其它编程语言的优缺点?
身为一个PHP开发者,有必要了解一下PHP的缺点,知道每种语言的优点和缺点,才能知道某种语言在什么场景下适合使用,在什么场景下不适合使用. 这个问题我曾经面试的时候遇到过,我之前没总结过,第一问大部分 ...
- 自定义View画一条线
#import "PublishContextView.h" @implementation PublishContextView -(void)drawRect:(CGRect) ...
- 00049_super关键字
1.子父类中构造方法的调用 (1)在创建子类对象时,父类的构造方法会先执行,因为子类中所有构造方法的第一行有默认的隐式super();语句: (2)格式 调用本类中的构造方法 this(实参列表); ...
- cf950e Data Center Maintenance
若推迟 \(u\) 必推迟 \(v\),则连边 <\(u,v\)>. 求强联通分量后缩点,答案显然是出度为 \(0\) 且 size 最小的 scc. #include <iostr ...
- Nmap手册
转自:http://drops.xmd5.com/static/drops/tips-4333.html 0x00:说明 只是一个快速查询手册,理论的东西都没有补充,欢迎大家积极在评论区补充自己常用的 ...