Java 在spring 4.2.5 maven 3中,如何替换assert类及其方法,以及使用哪个依赖项
Java 在spring 4.2.5 maven 3中,如何替换assert类及其方法,以及使用哪个依赖项,java,maven,junit,Java,Maven,Junit,assertEquals()中有错误,类型TATManagementServiceTestCase的方法assertEquals(int,int)未定义 我认为这个类是去润滑的,那么这个类及其方法的替代品是什么呢?我的代码: package ae.edaman.tat.service; import java.util.List; //import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
assertEquals()
中有错误,类型TATManagementServiceTestCase
的方法assertEquals(int,int)
未定义
我认为这个类是去润滑的,那么这个类及其方法的替代品是什么呢?我的代码:
package ae.edaman.tat.service;
import java.util.List;
//import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
import ae.edaman.common.exception.ApplicationException;
import ae.edaman.tat.model.ClientType;
import ae.edaman.tat.model.MemCountClassification;
import ae.edaman.tat.model.WorkflowStatusMapping;
public class TATManagementServiceTestCase extends AbstractJUnit4SpringContextTests
//AbstractDependencyInjectionSpringContextTests
{
protected String[] getConfigLocations() {
setAutowireMode(AUTOWIRE_BY_NAME);
return new String[] {
"applicationContext.xml"
};
}
private TATManagementService tatManagementService;
public void testClaimsMapping() {
Exception exception = null;
List<WorkflowStatusMapping> workflowStatusList = null;
try {
WorkflowStatusMapping searchCriteria = new WorkflowStatusMapping();
searchCriteria.setServiceCode("OCT");
workflowStatusList = tatManagementService.findWorkflowStatusMapping(searchCriteria);
} catch (ApplicationException ae) {
exception = ae;
}
assert exception == null;
assertEquals(8, workflowStatusList.size());//i have error in this line and also few more method like assertnull()
}
包ae.edaman.tat.service;
导入java.util.List;
//导入org.springframework.test.AbstractDependencyInjectionSpringContextTests;
导入org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
导入ae.edaman.common.exception.ApplicationException;
导入ae.edaman.tat.model.ClientType;
导入ae.edaman.tat.model.MemCountClassification;
导入ae.edaman.tat.model.WorkflowStatusMapping;
公共类TATManagementServiceTestCase扩展了AbstractJUnit4SpringContextTests
//AbstractDependencyInjectionSpringContextTests
{
受保护的字符串[]getConfigLocations(){
setAutowireMode(按名称自动连线);
返回新字符串[]{
“applicationContext.xml”
};
}
私人管理服务;
public void testClaimsMapping(){
异常=空;
List workflowStatusList=null;
试一试{
WorkflowStatusMapping searchCriteria=新建WorkflowStatusMapping();
searchCriteria.setServiceCode(“OCT”);
workflowStatusList=tatManagementService.findWorkflowStatusMapping(搜索条件);
}捕获(应用程序异常ae){
异常=不良事件;
}
断言异常==null;
assertEquals(8,workflowStatusList.size());//我在这一行中有错误,而且像assertnull()这样的方法也很少
}
我不会发送完整的代码,如果可能的话,请给我完整的依赖项和方法名称。您在JUnit4环境中使用JUnit3构造。请使用Unit中的
Assert
类,而不是超级方法。请您解释一下如何使用它。我是JUnit4的新手。您在JUnit4环境中使用JUnit3构造。美国从Unit而不是super方法创建Assert
类。请解释一下如何使用它。我对junit是新手