Skip to content

Commit 8e82c51

Browse files
committed
Running the tests in a specified order, also added more debugging statements
1 parent 1a67be7 commit 8e82c51

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

jaxrs/jaxrs-endpoint/src/test/java/org/javaee7/jaxrs/endpoint/MyResourceTest.java

+16-8
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@
1818
import org.junit.Test;
1919
import static org.junit.Assert.*;
2020
import org.junit.BeforeClass;
21+
import org.junit.FixMethodOrder;
2122
import org.junit.runner.RunWith;
23+
import org.junit.runners.MethodSorters;
2224

2325
/**
2426
* @author Arun Gupta
2527
*/
2628
//@RunWith(Arquillian.class)
29+
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
2730
public class MyResourceTest {
2831

2932
private static WebTarget target;
@@ -56,52 +59,57 @@ public static void setupClass() {
5659
* Test of POST method, of class MyResource.
5760
*/
5861
@Test
59-
public void testPost() {
62+
public void test1Post() {
6063
System.out.println("POST");
6164
target.request().post(Entity.text("apple"));
6265
String r = target.request().get(String.class);
66+
System.out.println(r);
6367
assertEquals("[apple]", r);
6468
}
6569

6670
/**
6771
* Test of PUT method, of class MyResource.
6872
*/
6973
@Test
70-
public void testPut() {
74+
public void test2Put() {
7175
System.out.println("PUT");
7276
target.request().put(Entity.text("banana"));
7377
String r = target.request().get(String.class);
78+
System.out.println(r);
7479
assertEquals("[apple, banana]", r);
7580
}
7681

7782
/**
7883
* Test of GET method, of class MyResource.
7984
*/
8085
@Test
81-
public void testGetAll() {
82-
System.out.println("GET");
86+
public void test3GetAll() {
87+
System.out.println("GET All");
8388
String r = target.request().get(String.class);
89+
System.out.println(r);
8490
assertEquals("[apple, banana]", r);
8591
}
8692

8793
/**
8894
* Test of GET method, of class MyResource.
8995
*/
9096
@Test
91-
public void testGetOne() {
92-
System.out.println("GET");
97+
public void test4GetOne() {
98+
System.out.println("GET One");
9399
String r = target.path("apple").request().get(String.class);
94-
assertEquals("[apple]", r);
100+
System.out.println(r);
101+
assertEquals("apple", r);
95102
}
96103

97104
/**
98105
* Test of GET method, of class MyResource.
99106
*/
100107
@Test
101-
public void testDelete() {
108+
public void test5Delete() {
102109
System.out.println("DELETE");
103110
target.path("banana").request().delete();
104111
String r = target.request().get(String.class);
112+
System.out.println(r);
105113
assertEquals("[apple]", r);
106114
}
107115

0 commit comments

Comments
 (0)