|
18 | 18 | import org.junit.Test;
|
19 | 19 | import static org.junit.Assert.*;
|
20 | 20 | import org.junit.BeforeClass;
|
| 21 | +import org.junit.FixMethodOrder; |
21 | 22 | import org.junit.runner.RunWith;
|
| 23 | +import org.junit.runners.MethodSorters; |
22 | 24 |
|
23 | 25 | /**
|
24 | 26 | * @author Arun Gupta
|
25 | 27 | */
|
26 | 28 | //@RunWith(Arquillian.class)
|
| 29 | +@FixMethodOrder(MethodSorters.NAME_ASCENDING) |
27 | 30 | public class MyResourceTest {
|
28 | 31 |
|
29 | 32 | private static WebTarget target;
|
@@ -56,52 +59,57 @@ public static void setupClass() {
|
56 | 59 | * Test of POST method, of class MyResource.
|
57 | 60 | */
|
58 | 61 | @Test
|
59 |
| - public void testPost() { |
| 62 | + public void test1Post() { |
60 | 63 | System.out.println("POST");
|
61 | 64 | target.request().post(Entity.text("apple"));
|
62 | 65 | String r = target.request().get(String.class);
|
| 66 | + System.out.println(r); |
63 | 67 | assertEquals("[apple]", r);
|
64 | 68 | }
|
65 | 69 |
|
66 | 70 | /**
|
67 | 71 | * Test of PUT method, of class MyResource.
|
68 | 72 | */
|
69 | 73 | @Test
|
70 |
| - public void testPut() { |
| 74 | + public void test2Put() { |
71 | 75 | System.out.println("PUT");
|
72 | 76 | target.request().put(Entity.text("banana"));
|
73 | 77 | String r = target.request().get(String.class);
|
| 78 | + System.out.println(r); |
74 | 79 | assertEquals("[apple, banana]", r);
|
75 | 80 | }
|
76 | 81 |
|
77 | 82 | /**
|
78 | 83 | * Test of GET method, of class MyResource.
|
79 | 84 | */
|
80 | 85 | @Test
|
81 |
| - public void testGetAll() { |
82 |
| - System.out.println("GET"); |
| 86 | + public void test3GetAll() { |
| 87 | + System.out.println("GET All"); |
83 | 88 | String r = target.request().get(String.class);
|
| 89 | + System.out.println(r); |
84 | 90 | assertEquals("[apple, banana]", r);
|
85 | 91 | }
|
86 | 92 |
|
87 | 93 | /**
|
88 | 94 | * Test of GET method, of class MyResource.
|
89 | 95 | */
|
90 | 96 | @Test
|
91 |
| - public void testGetOne() { |
92 |
| - System.out.println("GET"); |
| 97 | + public void test4GetOne() { |
| 98 | + System.out.println("GET One"); |
93 | 99 | String r = target.path("apple").request().get(String.class);
|
94 |
| - assertEquals("[apple]", r); |
| 100 | + System.out.println(r); |
| 101 | + assertEquals("apple", r); |
95 | 102 | }
|
96 | 103 |
|
97 | 104 | /**
|
98 | 105 | * Test of GET method, of class MyResource.
|
99 | 106 | */
|
100 | 107 | @Test
|
101 |
| - public void testDelete() { |
| 108 | + public void test5Delete() { |
102 | 109 | System.out.println("DELETE");
|
103 | 110 | target.path("banana").request().delete();
|
104 | 111 | String r = target.request().get(String.class);
|
| 112 | + System.out.println(r); |
105 | 113 | assertEquals("[apple]", r);
|
106 | 114 | }
|
107 | 115 |
|
|
0 commit comments