DateAdapterTest是DateAdapter的测试类,它负责测试将日期类型编组/解组成String数据类型,反之亦然。测试用例没有运行。
public class DateAdapterTest {
/* Date adapter is a class to marshall date type into String and unmarshall
viseversa.
*/
DateAdapter dateAdapter;
private static final String DATE_FORMAT = "2014-01-01";
private static final LocalDate DATE = new LocalDate(2014, 01, 01);
@BeforeClass
public void setUp(){
dateAdapter = new DateAdapter();
}
/*
* @param Date Date type
* @return String String data type date
* @throw Exception
*/
@Test
public void testMarshal() throws Exception{
String dateString = dateAdapter.marshal(DATE) ;
assertEquals(DATE_FORMAT, dateString);
}
/*
* @param String String data type
* @return date LocalDate type date
* @throw Exception
*/
@Test
public void testUnmarshal() throws Exception{
LocalDate date = dateAdapter.unmarshal(DATE_FORMAT);
assertEquals(DATE , date);
}
}
输出为
===============================================
Default test
Tests run: 0, Failures: 0, Skips: 0
===============================================
===============================================
Default suite
Total tests run: 0, Failures: 0, Skips: 0
===============================================
答案 0 :(得分:1)
同意durron597发表评论。您的问题似乎与您运行测试和junit测试配置的方式有关。
如果您正在使用Eclipse,请尝试右键单击测试方法并按Run JUnit Test
以检查您的测试是否运行良好。如果它这样做,那么你就会遇到配置问题。
顺便说一句,添加有关您使用什么工具运行JUnit测试的更多详细信息,我将根据它更新答案。