source: java2python/junit-t/src/test/java/testcode/AssertTest.java@ 498

Last change on this file since 498 was 481, checked in by wouter, 18 months ago

#147 added test. Also serves to show new issue #148

File size: 744 bytes
Line 
1package testcode;
2
3import static org.junit.Assert.assertEquals;
4
5public class AssertTest {
6
7 public AssertTest() {
8 test1();
9 test2();
10 }
11
12 /**
13 * The test code for Value
14 *
15 * @throws Exception
16 */
17 public static void main(String[] args) throws Exception {
18 new AssertTest();
19 }
20
21 public static void test1() {
22 assertEquals(1, 1);
23 System.out.println("1ok");
24 }
25
26 public static void test2() {
27 try {
28 assertEquals("not equal", 1, 2);
29 System.out.println("Test did not fail properly");
30 return;
31 } catch (AssertionError e) {
32 if (!e.getMessage().contains("not equal")) {
33 System.out.println(
34 "Test threw as expected but message does not contain 'not equal'");
35 return;
36 }
37 System.out.println("2ok");
38 }
39 }
40}
Note: See TracBrowser for help on using the repository browser.