Migrate to Junit 5 Jupiter
[lttng-ust-java-tests.git] / lttng-ust-java-tests-common / src / main / java / org / lttng / ust / agent / integration / events / ListEventsITBase.java
index dc3a10bb337615bfd97ab409b1c984c485f67153..5551db8f21f9faee4b583c5b2af02983025a3518 100644 (file)
 
 package org.lttng.ust.agent.integration.events;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.Collections;
+import java.util.List;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
 import org.lttng.tools.ILttngSession;
+import org.lttng.ust.agent.utils.TestPrintExtension;
 
 /**
  * Base class for the list events command tests
  */
+@ExtendWith(TestPrintExtension.class)
 public abstract class ListEventsITBase {
 
-    protected static final String LOGGER_NAME_1 = "org.lttng";
+    protected static final String LOGGER_NAME_1 = "org.lttng.somecomponent";
     protected static final String LOGGER_NAME_2 = "org.lttng.mycomponent";
     protected static final String LOGGER_NAME_3 = "org.lttng.myothercomponent-àéç";
 
@@ -44,7 +47,7 @@ public abstract class ListEventsITBase {
     /**
      * Common test setup
      */
-    @Before
+    @BeforeEach
     public void testSetup() {
         session = ILttngSession.createSession(null, getDomain());
     }
@@ -52,7 +55,7 @@ public abstract class ListEventsITBase {
     /**
      * Common test teardown
      */
-    @After
+    @AfterEach
     public void testTeardown() {
         session.close();
     }
@@ -70,7 +73,7 @@ public abstract class ListEventsITBase {
     @Test
     public void testManyLoggersNoneAttached() {
         /* Don't attach anything */
-        Set<String> actualEvents = session.listEvents();
+        List<String> actualEvents = session.listEvents();
         assertTrue(actualEvents.isEmpty());
     }
 
@@ -82,8 +85,11 @@ public abstract class ListEventsITBase {
     public void testManyLoggersSomeAttached() {
         attachHandlerToLogger(1, 1);
 
-        Set<String> expectedEvents = new HashSet<>(Arrays.asList(LOGGER_NAME_1));
-        Set<String> actualEvents = session.listEvents();
+        List<String> expectedEvents = Arrays.asList(LOGGER_NAME_1);
+        List<String> actualEvents = session.listEvents();
+
+        Collections.sort(expectedEvents);
+        Collections.sort(actualEvents);
 
         assertEquals(expectedEvents, actualEvents);
     }
@@ -98,8 +104,11 @@ public abstract class ListEventsITBase {
         attachHandlerToLogger(2, 2);
         attachHandlerToLogger(2, 3);
 
-        Set<String> expectedEvents = new HashSet<>(Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2, LOGGER_NAME_3));
-        Set<String> actualEvents = session.listEvents();
+        List<String> expectedEvents = Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2, LOGGER_NAME_3);
+        List<String> actualEvents = session.listEvents();
+
+        Collections.sort(expectedEvents);
+        Collections.sort(actualEvents);
 
         assertEquals(expectedEvents, actualEvents);
     }
@@ -116,8 +125,11 @@ public abstract class ListEventsITBase {
         detachHandlerFromLogger(2, 3);
         /* Only loggers 1 and 2 will be attached */
 
-        Set<String> expectedEvents = new HashSet<>(Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2));
-        Set<String> actualEvents = session.listEvents();
+        List<String> expectedEvents = Arrays.asList(LOGGER_NAME_1, LOGGER_NAME_2);
+        List<String> actualEvents = session.listEvents();
+
+        Collections.sort(expectedEvents);
+        Collections.sort(actualEvents);
 
         assertEquals(expectedEvents, actualEvents);
     }
@@ -134,7 +146,7 @@ public abstract class ListEventsITBase {
         detachHandlerFromLogger(2, 2);
         detachHandlerFromLogger(2, 3);
 
-        Set<String> actualEvents = session.listEvents();
+        List<String> actualEvents = session.listEvents();
         assertTrue(actualEvents.isEmpty());
     }
 }
This page took 0.024951 seconds and 4 git commands to generate.