*/
package org.opendaylight.transportpce.nbinotifications.consumer;
-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.Collections;
import java.util.HashMap;
import org.apache.kafka.clients.consumer.MockConsumer;
import org.apache.kafka.clients.consumer.OffsetResetStrategy;
import org.apache.kafka.common.TopicPartition;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.nbinotifications.utils.NotificationServiceDataUtils;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
private Subscriber<NotificationAlarmService, NotificationsAlarmService> subscriberAlarmService;
private Subscriber<NotificationTapiService, Notification> subscriberTapiService;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
mockConsumer = new MockConsumer<>(OffsetResetStrategy.EARLIEST);
mockConsumerAlarm = new MockConsumer<>(OffsetResetStrategy.EARLIEST);
mockConsumerTapi = new MockConsumer<>(OffsetResetStrategy.EARLIEST);
}
@Test
- public void subscribeServiceShouldBeSuccessful() {
+ void subscribeServiceShouldBeSuccessful() {
// from https://www.baeldung.com/kafka-mockconsumer
ConsumerRecord<String, NotificationsProcessService> record = new ConsumerRecord<>(
TOPIC, PARTITION, 0L, "key", NotificationServiceDataUtils.buildReceivedEvent());
mockConsumer.updateBeginningOffsets(startOffsets);
List<NotificationsProcessService> result = subscriberService.subscribe(TOPIC,
NotificationsProcessService.QNAME);
- assertEquals("There should be 1 record", 1, result.size());
- assertTrue("Consumer should be closed", mockConsumer.closed());
+ assertEquals(1, result.size(), "There should be 1 record");
+ assertTrue(mockConsumer.closed(), "Consumer should be closed");
}
@Test
- public void subscribeAlarmShouldBeSuccessful() {
+ void subscribeAlarmShouldBeSuccessful() {
// from https://www.baeldung.com/kafka-mockconsumer
ConsumerRecord<String, NotificationsAlarmService> record = new ConsumerRecord<>(
TOPIC, PARTITION, 0L, "key", NotificationServiceDataUtils.buildReceivedAlarmEvent());
mockConsumerAlarm.updateBeginningOffsets(startOffsets);
List<NotificationsAlarmService> result = subscriberAlarmService.subscribe(TOPIC,
NotificationsAlarmService.QNAME);
- assertEquals("There should be 1 record", 1, result.size());
- assertTrue("Consumer should be closed", mockConsumerAlarm.closed());
+ assertEquals(1, result.size(), "There should be 1 record");
+ assertTrue(mockConsumerAlarm.closed(), "Consumer should be closed");
}
@Test
- public void subscribeTapiAlarmShouldBeSuccessful() {
+ void subscribeTapiAlarmShouldBeSuccessful() {
// from https://www.baeldung.com/kafka-mockconsumer
ConsumerRecord<String, Notification> record = new ConsumerRecord<>(
TOPIC, PARTITION, 0L, "key", NotificationServiceDataUtils.buildReceivedTapiAlarmEvent());
mockConsumerTapi.updateBeginningOffsets(startOffsets);
List<Notification> result = subscriberTapiService.subscribe(TOPIC,
NotificationTapiService.QNAME);
- assertEquals("There should be 1 record", 1, result.size());
- assertTrue("Consumer should be closed", mockConsumerTapi.closed());
+ assertEquals(1, result.size(), "There should be 1 record");
+ assertTrue(mockConsumerTapi.closed(), "Consumer should be closed");
}
}
*/
package org.opendaylight.transportpce.nbinotifications.impl;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.concurrent.ExecutionException;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
import org.opendaylight.transportpce.common.network.NetworkTransactionService;
public static NetworkTransactionService networkTransactionService;
private TopicManager topicManager;
- @Before
- public void setUp() throws ExecutionException, InterruptedException {
+ @BeforeEach
+ void setUp() throws ExecutionException, InterruptedException {
topicManager = TopicManager.getInstance();
networkTransactionService = new NetworkTransactionImpl(getDataBroker());
JsonStringConverter<NotificationProcessService> converter = new JsonStringConverter<>(
}
@Test
- public void getNotificationsServiceEmptyDataTest() throws InterruptedException, ExecutionException {
+ void getNotificationsServiceEmptyDataTest() throws InterruptedException, ExecutionException {
ListenableFuture<RpcResult<GetNotificationsProcessServiceOutput>> result =
nbiNotificationsImpl.getNotificationsProcessService(
new GetNotificationsProcessServiceInputBuilder().build());
- assertNull("Should be null", result.get().getResult().getNotificationsProcessService());
+ assertNull(result.get().getResult().getNotificationsProcessService(), "Should be null");
}
@Test
- public void getNotificationsServiceTest() throws InterruptedException, ExecutionException {
+ void getNotificationsServiceTest() throws InterruptedException, ExecutionException {
GetNotificationsProcessServiceInputBuilder builder = new GetNotificationsProcessServiceInputBuilder()
.setGroupId("groupId")
.setIdConsumer("consumerId")
.setConnectionType(ConnectionType.Service);
ListenableFuture<RpcResult<GetNotificationsProcessServiceOutput>> result =
nbiNotificationsImpl.getNotificationsProcessService(builder.build());
- assertNull("Should be null", result.get().getResult().getNotificationsProcessService());
+ assertNull(result.get().getResult().getNotificationsProcessService(), "Should be null");
}
@Test
- public void getNotificationsAlarmServiceTest() throws InterruptedException, ExecutionException {
+ void getNotificationsAlarmServiceTest() throws InterruptedException, ExecutionException {
GetNotificationsAlarmServiceInputBuilder builder = new GetNotificationsAlarmServiceInputBuilder()
.setGroupId("groupId")
.setIdConsumer("consumerId")
.setConnectionType(ConnectionType.Service);
ListenableFuture<RpcResult<GetNotificationsAlarmServiceOutput>> result =
nbiNotificationsImpl.getNotificationsAlarmService(builder.build());
- assertNull("Should be null", result.get().getResult().getNotificationsAlarmService());
+ assertNull(result.get().getResult().getNotificationsAlarmService(), "Should be null");
}
@Test
- public void createTapiNotificationSubscriptionServiceTest() throws InterruptedException, ExecutionException {
+ void createTapiNotificationSubscriptionServiceTest() throws InterruptedException, ExecutionException {
CreateNotificationSubscriptionServiceInputBuilder builder
= NotificationServiceDataUtils.buildNotificationSubscriptionServiceInputBuilder();
ListenableFuture<RpcResult<CreateNotificationSubscriptionServiceOutput>> result =
nbiNotificationsImpl.createNotificationSubscriptionService(builder.build());
- assertNotNull("Should receive UUID for subscription service",
- result.get().getResult().getSubscriptionService().getUuid().toString());
+ assertNotNull(result.get().getResult().getSubscriptionService().getUuid().toString(),
+ "Should receive UUID for subscription service");
}
@Test
- public void getTapiNotificationsServiceTest() throws InterruptedException, ExecutionException {
+ void getTapiNotificationsServiceTest() throws InterruptedException, ExecutionException {
CreateNotificationSubscriptionServiceInputBuilder builder
= NotificationServiceDataUtils.buildNotificationSubscriptionServiceInputBuilder();
ListenableFuture<RpcResult<CreateNotificationSubscriptionServiceOutput>> result =
.setSubscriptionIdOrName(result.get().getResult().getSubscriptionService().getUuid().getValue());
ListenableFuture<RpcResult<GetNotificationListOutput>> result1 =
nbiNotificationsImpl.getNotificationList(builder1.build());
- assertNull("Should be null", result1.get().getResult().getNotification());
+ assertNull(result1.get().getResult().getNotification(), "Should be null");
}
}
import static org.mockito.Mockito.verify;
import java.util.Arrays;
-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.MockitoAnnotations;
import org.opendaylight.mdsal.binding.api.NotificationService;
@Mock
private NotificationService notificationService;
- @Before
- public void init() {
+ @BeforeEach
+ void init() {
MockitoAnnotations.openMocks(this);
-
}
@Test
- public void initTest() {
+ void initTest() {
networkTransactionService = new NetworkTransactionImpl(getDataBroker());
NbiNotificationsProvider provider = new NbiNotificationsProvider(
Arrays.asList("topic1", "topic2"), Arrays.asList("topic1", "topic2"), "localhost:8080",
*/
package org.opendaylight.transportpce.nbinotifications.listener;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
-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.MockitoAnnotations;
import org.opendaylight.transportpce.nbinotifications.producer.Publisher;
@Mock
private Publisher<NotificationTapiService> publisherTapiService;
- @Before
- public void setUp() throws ExecutionException, InterruptedException {
+ @BeforeEach
+ void setUp() throws ExecutionException, InterruptedException {
MockitoAnnotations.openMocks(this);
}
@Test
- public void onPublishNotificationServiceTest() {
+ void onPublishNotificationServiceTest() {
NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
Map.of("test", publisherAlarm), Map.of("test", publisherTapiService));
PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder()
}
@Test
- public void onPublishNotificationServiceWrongPublisherTest() {
+ void onPublishNotificationServiceWrongPublisherTest() {
NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
Map.of("test", publisherAlarm), Map.of("test", publisherTapiService));
PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder()
}
@Test
- public void onPublishNotificationAlarmServiceTest() {
+ void onPublishNotificationAlarmServiceTest() {
NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
Map.of("test", publisherAlarm), Map.of("test", publisherTapiService));
PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder()
}
@Test
- public void onPublishNotificationAlarmServiceWrongPublisherTest() {
+ void onPublishNotificationAlarmServiceWrongPublisherTest() {
NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
Map.of("test", publisherAlarm), Map.of("test", publisherTapiService));
PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder()
}
@Test
- public void onPublishTapiNotificationServiceTest() throws ExecutionException, InterruptedException {
+ void onPublishTapiNotificationServiceTest() throws ExecutionException, InterruptedException {
NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
Map.of("test", publisherAlarm), Map.of("test", publisherTapiService));
}
@Test
- public void onPublishTapiNotificationServiceTestWrongPublisherTest() {
+ void onPublishTapiNotificationServiceTestWrongPublisherTest() {
NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
Map.of("test", publisherAlarm), Map.of("test", publisherTapiService));
PublishTapiNotificationService notification
}
@Test
- public void getTapiPublisherFromTopicTest() {
+ void getTapiPublisherFromTopicTest() {
NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
Map.of("test", publisherAlarm), Map.of("test", publisherTapiService));
assertNull(listener.getTapiPublisherFromTopic("toto"));
*/
package org.opendaylight.transportpce.nbinotifications.producer;
-import static org.junit.Assert.assertEquals;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.nio.file.Files;
import java.util.concurrent.ExecutionException;
import org.apache.kafka.clients.producer.MockProducer;
import org.apache.kafka.common.serialization.StringSerializer;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.MockitoAnnotations;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.common.network.NetworkTransactionImpl;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
public class PublisherTest extends AbstractTest {
+ private static NetworkTransactionService networkTransactionService;
+
private JsonStringConverter<NotificationProcessService> converterService;
private JsonStringConverter<NotificationAlarmService> converterAlarm;
private JsonStringConverter<NotificationTapiService> converterTapiService;
private NbiNotificationsImpl nbiNotificationsImpl;
private TopicManager topicManager;
- public static NetworkTransactionService networkTransactionService;
- @Before
- public void setUp() throws ExecutionException, InterruptedException {
+ @BeforeEach
+ void setUp() throws ExecutionException, InterruptedException {
topicManager = TopicManager.getInstance();
converterService = new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
converterAlarm = new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
}
@Test
- public void sendEventServiceShouldBeSuccessful() throws IOException {
+ void sendEventServiceShouldBeSuccessful() throws IOException {
String json = Files.readString(Paths.get("src/test/resources/event.json"));
NotificationProcessService notificationProcessService = converterService
.createDataObjectFromJsonString(YangInstanceIdentifier.of(NotificationProcessService.QNAME),
json, JSONCodecFactorySupplier.RFC7951);
publisherService.sendEvent(notificationProcessService, notificationProcessService.getConnectionType().name());
- assertEquals("We should have one message", 1, mockProducer.history().size());
- assertEquals("Key should be test", "test", mockProducer.history().get(0).key());
+ assertEquals(1, mockProducer.history().size(), "We should have one message");
+ assertEquals("test", mockProducer.history().get(0).key(), "Key should be test");
}
@Test
- public void sendEventAlarmShouldBeSuccessful() throws IOException {
+ void sendEventAlarmShouldBeSuccessful() throws IOException {
String json = Files.readString(Paths.get("src/test/resources/event_alarm_service.json"));
NotificationAlarmService notificationAlarmService = converterAlarm
.createDataObjectFromJsonString(YangInstanceIdentifier.of(NotificationAlarmService.QNAME),
json, JSONCodecFactorySupplier.RFC7951);
publisherAlarm.sendEvent(notificationAlarmService, "alarm"
+ notificationAlarmService.getConnectionType().getName());
- assertEquals("We should have one message", 1, mockAlarmProducer.history().size());
- assertEquals("Key should be test", "test", mockAlarmProducer.history().get(0).key());
+ assertEquals(1, mockAlarmProducer.history().size(), "We should have one message");
+ assertEquals("test", mockAlarmProducer.history().get(0).key(), "Key should be test");
}
@Test
- public void sendTapiEventShouldBeSuccessful() throws IOException {
+ void sendTapiEventShouldBeSuccessful() throws IOException {
CreateNotificationSubscriptionServiceInputBuilder builder
= NotificationServiceDataUtils.buildNotificationSubscriptionServiceInputBuilder();
SubscriptionFilter subscriptionFilter = new SubscriptionFilterBuilder(builder.getSubscriptionFilter())
.createDataObjectFromJsonString(YangInstanceIdentifier.of(NotificationTapiService.QNAME),
json, JSONCodecFactorySupplier.RFC7951);
publisherTapiService.sendEvent(notificationTapiService, "");
- assertEquals("We should have one message", 1, mockTapiProducer.history().size());
- assertEquals("Key should be test", "test", mockTapiProducer.history().get(0).key());
+ assertEquals(1, mockTapiProducer.history().size(), "We should have one message");
+ assertEquals("test", mockTapiProducer.history().get(0).key(), "Key should be test");
}
}
*/
package org.opendaylight.transportpce.nbinotifications.serialization;
-import static org.junit.Assert.assertEquals;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
public class NotificationAlarmServiceDeserializerTest extends AbstractTest {
@Test
- public void deserializeTest() throws IOException {
+ void deserializeTest() throws IOException {
JsonStringConverter<NotificationAlarmService> converter =
new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
NotificationAlarmServiceDeserializer deserializer = new NotificationAlarmServiceDeserializer();
NotificationsAlarmService readEvent = deserializer.deserialize("Test",
Files.readAllBytes(Paths.get("src/test/resources/event_alarm_service.json")));
deserializer.close();
- assertEquals("Service name should be service1", "service1", readEvent.getServiceName());
- assertEquals("message should be The service is now inService", "The service is now inService",
- readEvent.getMessage());
+ assertEquals("service1", readEvent.getServiceName(), "Service name should be service1");
+ assertEquals("The service is now inService", readEvent.getMessage(),
+ "message should be The service is now inService");
}
}
*/
package org.opendaylight.transportpce.nbinotifications.serialization;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService;
public class NotificationAlarmServiceSerializerTest extends AbstractTest {
@Test
- public void serializeTest() throws IOException {
+ void serializeTest() throws IOException {
JsonStringConverter<NotificationAlarmService> converter =
new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
String json = Files.readString(Paths.get("src/test/resources/event_alarm_service.json"));
serializer.configure(configs, false);
byte[] data = serializer.serialize("test", notificationAlarmService);
serializer.close();
- assertNotNull("Serialized data should not be null", data);
+ assertNotNull(data, "Serialized data should not be null");
String expectedJson = Files.readString(Paths.get("src/test/resources/expected_event_alarm_service.json"));
// Minify the json string
expectedJson = new ObjectMapper().readValue(expectedJson, JsonNode.class).toString();
- assertEquals("The event should be equals", expectedJson, new String(data, StandardCharsets.UTF_8));
+ assertEquals(expectedJson, new String(data, StandardCharsets.UTF_8), "The event should be equals");
}
}
*/
package org.opendaylight.transportpce.nbinotifications.serialization;
-import static org.junit.Assert.assertEquals;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
public class NotificationServiceDeserializerTest extends AbstractTest {
@Test
- public void deserializeTest() throws IOException {
+ void deserializeTest() throws IOException {
JsonStringConverter<NotificationProcessService> converter = new JsonStringConverter<>(
getDataStoreContextUtil().getBindingDOMCodecServices());
NotificationServiceDeserializer deserializer = new NotificationServiceDeserializer();
NotificationsProcessService readEvent = deserializer.deserialize("Test",
Files.readAllBytes(Paths.get("src/test/resources/event.json")));
deserializer.close();
- assertEquals("Service name should be service1", "service1", readEvent.getServiceName());
+ assertEquals("service1", readEvent.getServiceName(), "Service name should be service1");
}
}
*/
package org.opendaylight.transportpce.nbinotifications.serialization;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService;
public class NotificationServiceSerializerTest extends AbstractTest {
@Test
- public void serializeTest() throws IOException {
+ void serializeTest() throws IOException {
JsonStringConverter<NotificationProcessService> converter =
new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
String json = Files.readString(Paths.get("src/test/resources/event.json"));
serializer.configure(configs, false);
byte[] data = serializer.serialize("test", notificationService);
serializer.close();
- assertNotNull("Serialized data should not be null", data);
+ assertNotNull(data, "Serialized data should not be null");
String expectedJson = Files.readString(Paths.get("src/test/resources/expected_event.json"));
// Minify the json string
expectedJson = new ObjectMapper().readValue(expectedJson, JsonNode.class).toString();
- assertEquals("The event should be equals", expectedJson, new String(data, StandardCharsets.UTF_8));
+ assertEquals(expectedJson, new String(data, StandardCharsets.UTF_8), "The event should be equals");
}
}
*/
package org.opendaylight.transportpce.nbinotifications.serialization;
-import static org.junit.Assert.assertEquals;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
public class NotificationTapiServiceDeserializerTest extends AbstractTest {
@Test
- public void deserializeTest() throws IOException {
+ void deserializeTest() throws IOException {
JsonStringConverter<NotificationTapiService> converter = new JsonStringConverter<>(
getDataStoreContextUtil().getBindingDOMCodecServices());
TapiNotificationDeserializer deserializer = new TapiNotificationDeserializer();
Notification readEvent = deserializer.deserialize("76d8f07b-ead5-4132-8eb8-cf3fdef7e079",
Files.readAllBytes(Paths.get("src/test/resources/tapi_event.json")));
deserializer.close();
- assertEquals("Service uuid should be 76d8f07b-ead5-4132-8eb8-cf3fdef7e079",
- "76d8f07b-ead5-4132-8eb8-cf3fdef7e079", readEvent.getTargetObjectIdentifier().getValue());
+ assertEquals("76d8f07b-ead5-4132-8eb8-cf3fdef7e079", readEvent.getTargetObjectIdentifier().getValue(),
+ "Service uuid should be 76d8f07b-ead5-4132-8eb8-cf3fdef7e079");
}
}
*/
package org.opendaylight.transportpce.nbinotifications.serialization;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Map;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.common.converter.JsonStringConverter;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService;
public class NotificationTapiServiceSerializerTest extends AbstractTest {
@Test
- public void serializeTest() throws IOException {
+ void serializeTest() throws IOException {
JsonStringConverter<NotificationTapiService> converter =
new JsonStringConverter<>(getDataStoreContextUtil().getBindingDOMCodecServices());
String json = Files.readString(Paths.get("src/test/resources/tapi_event.json"));
serializer.configure(configs, false);
byte[] data = serializer.serialize("test", notificationService);
serializer.close();
- assertNotNull("Serialized data should not be null", data);
+ assertNotNull(data, "Serialized data should not be null");
String expectedJson = Files.readString(Paths.get("src/test/resources/expected_tapi_event.json"));
// Minify the json string
expectedJson = new ObjectMapper().readValue(expectedJson, JsonNode.class).toString();
- assertEquals("The event should be equals", expectedJson, new String(data, StandardCharsets.UTF_8));
+ assertEquals(expectedJson, new String(data, StandardCharsets.UTF_8), "The event should be equals");
}
}