Nextday参数化单元测试

本文详细介绍了如何利用Nextday库进行参数化单元测试,通过实例展示了如何设置测试参数,执行不同输入下的测试用例,并解释了参数化测试在提升代码覆盖率和确保程序健壮性方面的重要性。
摘要由CSDN通过智能技术生成
import static org.junit.Assert.*;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collection;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;


@RunWith(value = Parameterized.class)
public class NextdayTest {

	private Date expected;
	
	private Date value;
	
	@Parameters
	public static Collection getTestParameters() {        // 下面依次设计有效等价类、无效等价类等
		
		//有效等价类
		Date d1 = new Date(5, 14, 2014);
		Date d2 = new Date(5, 13, 2014);
		
		//为负日期
		// Date d3 = new Date(5, 0, 2014);
		// Date d4 = new Date(5, -1, 2014);
		
		// //为零日期
		// Date d5 = new Date(5, 1, 2014);
		// Date d6 = new Date(5, 0, 2014);
		
		//31号
		Date d7 = new Date(8, 31, 2015);
		Date d8 = new Date(8, 30, 2015);
		
		Date d9 = new Date(7, 31, 2014);
		Date d10 = new Date(7, 30, 2014);
		
		Date d11 = new Date(7, 1, 2013);
		Dat
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值