<dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter</artifactId> <version>5.7.0</version> <scope>test</scope> </dependency> |
JUnit 5 = JUnit Platform + JUnit Jupiter + JUnit Vintage |
public class TestNodeDemo { private String id = "1000"; private String nodeTypeId = "6"; Node node = new Node(this.id,this.nodeTypeId); @Test public void testAssertEquals(){ nodeTypeId = "7"; assertEquals("你错了",nodeTypeId,node.printNodeTypeId()); } @Test public void testAssertTrue(){ assertTrue(1==2); } @Test public void testAssetFalse(){ assertFalse(1==2); } @Test public void testAssertSame(){ String a = "hi"; String b = "hi33"; assertSame(a,b); } @Test public void testAssertNotNull(){ Object object = null; assertNotNull(object); } @Test public void testAssertNotNull2(){ Object object = null; assertNotNull("你给我的东西是空的",object); } } |
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) | Powered by Discuz! X3.2 |