Migrate dmaap-client module to JUnit5 42/104642/3
authorGilles Thouenon <gilles.thouenon@orange.com>
Sat, 25 Feb 2023 19:09:23 +0000 (20:09 +0100)
committerGilles Thouenon <gilles.thouenon@orange.com>
Sat, 4 Mar 2023 07:30:11 +0000 (08:30 +0100)
JIRA: TRNSPRTPCE-730
Signed-off-by: Gilles Thouenon <gilles.thouenon@orange.com>
Change-Id: Id10e6573845a80d1a9455ab431e766332b09a752

dmaap-client/src/test/java/org/opendaylight/transportpce/dmaap/client/impl/DmaapClientProviderTest.java
dmaap-client/src/test/java/org/opendaylight/transportpce/dmaap/client/listener/NbiNotificationsListenerImplTest.java

index 1ebfadee53dd7334ce16b71362278b4d18aa9a8d..6c66201aa12683e556cd99b01e2c75af07e2525a 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.transportpce.dmaap.client.impl;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
@@ -24,15 +24,15 @@ public class DmaapClientProviderTest {
     @Mock
     private NotificationService notificationService;
 
-    @Before
-    public void init() {
+    @BeforeEach
+    void init() {
         MockitoAnnotations.openMocks(this);
-
     }
 
     @Test
-    public void testInitRegisterNbiNotificationsToRpcRegistry() {
-        DmaapClientProvider provider =  new DmaapClientProvider(notificationService, "http://localhost", "username", "password");
+    void testInitRegisterNbiNotificationsToRpcRegistry() {
+        DmaapClientProvider provider =
+            new DmaapClientProvider(notificationService, "http://localhost", "username", "password");
         provider.init();
         (verify(notificationService, times(1)))
                 .registerNotificationListener(Mockito.any(NbiNotificationsListenerImpl.class));
index f3df78362adfc1cf0e69b74e388c0e72256b52eb..5a5b31b896a89483074a1e83104593538fbf06b9 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.transportpce.dmaap.client.listener;
 
-import static org.junit.Assert.assertEquals;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import ch.qos.logback.classic.Logger;
 import ch.qos.logback.classic.spi.ILoggingEvent;
@@ -18,7 +19,7 @@ import javax.ws.rs.core.Application;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.test.JerseyTest;
 import org.glassfish.jersey.test.TestProperties;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.opendaylight.transportpce.dmaap.client.resource.EventsApiStub;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev210528.NodeIdType;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ConnectionType;
@@ -46,7 +47,7 @@ public class NbiNotificationsListenerImplTest extends JerseyTest {
     }
 
     @Test
-    public void onPublishNotificationServiceTest() {
+    void onPublishNotificationServiceTest() {
         Logger logger = (Logger) LoggerFactory.getLogger(NbiNotificationsListenerImpl.class);
         ListAppender<ILoggingEvent> listAppender = new ListAppender<>();
         listAppender.start();
@@ -82,7 +83,6 @@ public class NbiNotificationsListenerImplTest extends JerseyTest {
         listener.onPublishNotificationProcessService(notification);
         // as onPublishNotificationService is a void method, we check log message to be sure everything went well
         List<ILoggingEvent> logsList = listAppender.list;
-        assertEquals("Response received CreatedEvent [serverTimeMs=1, count=1]", logsList.get(1).getFormattedMessage());
-
+        assertEquals(logsList.get(1).getFormattedMessage(), "Response received CreatedEvent [serverTimeMs=1, count=1]");
     }
 }