Eclipse的CodePro生成JUnit测试,但是,即使不可能引发检查的异常,它生成的所有测试方法也会抛出Exception
。这是CodePro的限制,还是我以前从未见过的良好的JUnit练习?为什么CodePro junit测试方法抛出Exception(在Eclipse中)?
例如:
@Test
public void testCategory_1()
throws Exception {
String categoryName = "";
Category result = new Category(categoryName);
// add additional test code here
assertNotNull(result);
assertEquals(null, result.getCategoryName());
}
凡new Category(String)
和result.getCategoryName()
不抛出任何checked异常。
我没有看到这方面的优势。 – mkro