您的位置:首页 > 其它

ANT:与Junit的整合(一):Junit4

2015-12-16 08:18 344 查看
public class TestHello {

private HelloWorld hw;



@Before

public void setUp() {

hw = new HelloWorld();

}



@Test

public void testHello() {

String str = hw.hello();

assertEquals("hello 测试失败",str,"world");

}



@Test

public void testWorld() {

String str = hw.world();

assertEquals("world 测试失败",str, "hello");

}



@Test

public void testNil() {

assertNull("对象不为空",hw.nil());

}



@Test

public void testNotNil() {

assertNotNull("对象为空", hw.notNil());

}



@Test(expected=NumberFormatException.class)

public void testExt() {

hw.ext();

}



@After

public void tearDown() {

hw = null;

}



}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: