Repository: aries-jax-rs-whiteboard
Updated Branches:
  refs/heads/master 6e6b20462 -> 324bc303c


Make tests independent of order


Project: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/commit/324bc303
Tree: 
http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/tree/324bc303
Diff: 
http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/diff/324bc303

Branch: refs/heads/master
Commit: 324bc303c9e4b19b2a360108025efa73200d9cb2
Parents: 6e6b204
Author: Carlos Sierra <csie...@apache.org>
Authored: Mon Feb 12 17:58:49 2018 +0100
Committer: Carlos Sierra <csie...@apache.org>
Committed: Mon Feb 12 17:58:49 2018 +0100

----------------------------------------------------------------------
 .../introspection/ClassIntrospectorTest.java    | 180 ++++++++++++-------
 1 file changed, 112 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/324bc303/jax-rs.whiteboard/src/test/java/org/apache/aries/jax/rs/whiteboard/internal/introspection/ClassIntrospectorTest.java
----------------------------------------------------------------------
diff --git 
a/jax-rs.whiteboard/src/test/java/org/apache/aries/jax/rs/whiteboard/internal/introspection/ClassIntrospectorTest.java
 
b/jax-rs.whiteboard/src/test/java/org/apache/aries/jax/rs/whiteboard/internal/introspection/ClassIntrospectorTest.java
index 2cfea49..ba88857 100644
--- 
a/jax-rs.whiteboard/src/test/java/org/apache/aries/jax/rs/whiteboard/internal/introspection/ClassIntrospectorTest.java
+++ 
b/jax-rs.whiteboard/src/test/java/org/apache/aries/jax/rs/whiteboard/internal/introspection/ClassIntrospectorTest.java
@@ -79,30 +79,37 @@ public class ClassIntrospectorTest {
 
         assertEquals(2, resourceMethodInfoDTOS.length);
 
+        List<ResourceMethodInfoDTOWrapper> wrappers = Arrays.stream(
+            resourceMethodInfoDTOS
+        ).map(
+            ResourceMethodInfoDTOWrapper::new
+        ).collect(
+            Collectors.toList()
+        );
+
         ResourceMethodInfoDTO resourceMethodInfoDTO =
-            resourceMethodInfoDTOS[0];
+            new ResourceMethodInfoDTO();
 
-        assertEquals(HttpMethod.GET, resourceMethodInfoDTO.method);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.consumingMimeType);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.producingMimeType);
-        assertEquals("/", resourceMethodInfoDTO.path);
-        assertArrayEquals(
-            new String[]{"test.types.Bound"},
-            resourceMethodInfoDTO.nameBindings);
+        resourceMethodInfoDTO.method = HttpMethod.GET;
+        resourceMethodInfoDTO.consumingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.producingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.path = "/";
+        resourceMethodInfoDTO.nameBindings = new String[]{"test.types.Bound"};
 
-        resourceMethodInfoDTO = resourceMethodInfoDTOS[1];
+        assertTrue(
+            wrappers.remove(
+                new ResourceMethodInfoDTOWrapper(resourceMethodInfoDTO)));
 
-        assertEquals(HttpMethod.POST, resourceMethodInfoDTO.method);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.consumingMimeType);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.producingMimeType);
-        assertEquals("/", resourceMethodInfoDTO.path);
-        assertArrayEquals(
-            new String[]{"test.types.Bound"},
-            resourceMethodInfoDTO.nameBindings);
+        resourceMethodInfoDTO = new ResourceMethodInfoDTO();
+        resourceMethodInfoDTO.method = HttpMethod.POST;
+        resourceMethodInfoDTO.consumingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.producingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.path = "/";
+        resourceMethodInfoDTO.nameBindings = new String[]{"test.types.Bound"};
+
+        assertTrue(
+            wrappers.remove(
+                new ResourceMethodInfoDTOWrapper(resourceMethodInfoDTO)));
     }
 
 
@@ -118,26 +125,38 @@ public class ClassIntrospectorTest {
 
         assertEquals(2, resourceMethodInfoDTOS.length);
 
+        List<ResourceMethodInfoDTOWrapper> wrappers = Arrays.stream(
+            resourceMethodInfoDTOS
+        ).map(
+            ResourceMethodInfoDTOWrapper::new
+        ).collect(
+            Collectors.toList()
+        );
+
         ResourceMethodInfoDTO resourceMethodInfoDTO =
-            resourceMethodInfoDTOS[0];
+            new ResourceMethodInfoDTO();
 
-        assertEquals(HttpMethod.GET, resourceMethodInfoDTO.method);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.consumingMimeType);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.producingMimeType);
-        assertEquals("/", resourceMethodInfoDTO.path);
-        assertArrayEquals(new String[]{}, resourceMethodInfoDTO.nameBindings);
+        resourceMethodInfoDTO.method = HttpMethod.GET;
+        resourceMethodInfoDTO.consumingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.producingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.path = "/";
+        resourceMethodInfoDTO.nameBindings = new String[]{};
 
-        resourceMethodInfoDTO = resourceMethodInfoDTOS[1];
+        assertTrue(
+            wrappers.remove(
+                new ResourceMethodInfoDTOWrapper(resourceMethodInfoDTO)));
 
-        assertEquals(HttpMethod.POST, resourceMethodInfoDTO.method);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.consumingMimeType);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.producingMimeType);
-        assertEquals("/", resourceMethodInfoDTO.path);
-        assertArrayEquals(new String[]{}, resourceMethodInfoDTO.nameBindings);
+        resourceMethodInfoDTO = new ResourceMethodInfoDTO();
+
+        resourceMethodInfoDTO.method = HttpMethod.POST;
+        resourceMethodInfoDTO.consumingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.producingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.path = "/";
+        resourceMethodInfoDTO.nameBindings = new String[]{};
+
+        assertTrue(
+            wrappers.remove(
+                new ResourceMethodInfoDTOWrapper(resourceMethodInfoDTO)));
     }
 
     @Test
@@ -152,26 +171,39 @@ public class ClassIntrospectorTest {
 
         assertEquals(2, resourceMethodInfoDTOS.length);
 
+        List<ResourceMethodInfoDTOWrapper> wrappers = Arrays.stream(
+            resourceMethodInfoDTOS
+        ).map(
+            ResourceMethodInfoDTOWrapper::new
+        ).collect(
+            Collectors.toList()
+        );
+
         ResourceMethodInfoDTO resourceMethodInfoDTO =
-            resourceMethodInfoDTOS[0];
+            new ResourceMethodInfoDTO();
 
-        assertEquals(HttpMethod.GET, resourceMethodInfoDTO.method);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.consumingMimeType);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.producingMimeType);
-        assertEquals("/common", resourceMethodInfoDTO.path);
-        assertArrayEquals(new String[]{}, resourceMethodInfoDTO.nameBindings);
+        resourceMethodInfoDTO.method = HttpMethod.GET;
+        resourceMethodInfoDTO.consumingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.producingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.path = "/common";
+        resourceMethodInfoDTO.nameBindings = new String[]{};
 
-        resourceMethodInfoDTO = resourceMethodInfoDTOS[1];
+        assertTrue(
+            wrappers.remove(
+                new ResourceMethodInfoDTOWrapper(resourceMethodInfoDTO)));
 
-        assertEquals(HttpMethod.POST, resourceMethodInfoDTO.method);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.consumingMimeType);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.producingMimeType);
-        assertEquals("/common", resourceMethodInfoDTO.path);
-        assertArrayEquals(new String[]{}, resourceMethodInfoDTO.nameBindings);
+        resourceMethodInfoDTO =
+            new ResourceMethodInfoDTO();
+
+        resourceMethodInfoDTO.method = HttpMethod.POST;
+        resourceMethodInfoDTO.consumingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.producingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.path = "/common";
+        resourceMethodInfoDTO.nameBindings = new String[]{};
+
+        assertTrue(
+            wrappers.remove(
+                new ResourceMethodInfoDTOWrapper(resourceMethodInfoDTO)));
     }
 
     @Test
@@ -186,26 +218,38 @@ public class ClassIntrospectorTest {
 
         assertEquals(2, resourceMethodInfoDTOS.length);
 
+        List<ResourceMethodInfoDTOWrapper> wrappers = Arrays.stream(
+            resourceMethodInfoDTOS
+        ).map(
+            ResourceMethodInfoDTOWrapper::new
+        ).collect(
+            Collectors.toList()
+        );
+
         ResourceMethodInfoDTO resourceMethodInfoDTO =
-            resourceMethodInfoDTOS[0];
+            new ResourceMethodInfoDTO();
 
-        assertEquals(HttpMethod.GET, resourceMethodInfoDTO.method);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.consumingMimeType);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.producingMimeType);
-        assertEquals("/common", resourceMethodInfoDTO.path);
-        assertArrayEquals(new String[]{}, resourceMethodInfoDTO.nameBindings);
+        resourceMethodInfoDTO.method = HttpMethod.GET;
+        resourceMethodInfoDTO.consumingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.producingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.path = "/common";
+        resourceMethodInfoDTO.nameBindings = new String[]{};
 
-        resourceMethodInfoDTO = resourceMethodInfoDTOS[1];
+        assertTrue(
+            wrappers.remove(
+                new ResourceMethodInfoDTOWrapper(resourceMethodInfoDTO)));
 
-        assertEquals(HttpMethod.POST, resourceMethodInfoDTO.method);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.consumingMimeType);
-        assertArrayEquals(
-            ALL_TYPES, resourceMethodInfoDTO.producingMimeType);
-        assertEquals("/common/different", resourceMethodInfoDTO.path);
-        assertArrayEquals(new String[]{}, resourceMethodInfoDTO.nameBindings);
+        resourceMethodInfoDTO = new ResourceMethodInfoDTO();
+
+        resourceMethodInfoDTO.method = HttpMethod.POST;
+        resourceMethodInfoDTO.consumingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.producingMimeType = ALL_TYPES;
+        resourceMethodInfoDTO.path = "/common/different";
+        resourceMethodInfoDTO.nameBindings = new String[]{};
+
+        assertTrue(
+            wrappers.remove(
+                new ResourceMethodInfoDTOWrapper(resourceMethodInfoDTO)));
     }
 
     @Test

Reply via email to