aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core
diff options
context:
space:
mode:
authorxuegao <xue.gao@intl.att.com>2021-03-19 14:04:17 +0100
committerChristophe Closset <christophe.closset@intl.att.com>2021-03-24 07:00:09 +0000
commitb2c0528da052b5c73e3fc1f7f98d22578acd91f0 (patch)
tree12a64e553c7c6c321b4a8ec83880777f1c485f5e /openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core
parentd378c37fbd1ecec7b43394926f1ca32a695e07de (diff)
Improve test coverage
Add unit tests to improve test coverage. Issue-ID: SDC-3428 Change-Id: I29a8f1d49f1dfd6bca79f3d873d1e1ff7adc4fb2 Signed-off-by: xuegao <xue.gao@intl.att.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core')
-rw-r--r--openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/destinationprovider/impl/MulticastDestinationTest.java28
1 files changed, 13 insertions, 15 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/destinationprovider/impl/MulticastDestinationTest.java b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/destinationprovider/impl/MulticastDestinationTest.java
index b739f32513..78265769e5 100644
--- a/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/destinationprovider/impl/MulticastDestinationTest.java
+++ b/openecomp-be/lib/openecomp-sdc-notification-lib/openecomp-sdc-notification-core/src/test/java/org/openecomp/sdc/destinationprovider/impl/MulticastDestinationTest.java
@@ -20,10 +20,10 @@
package org.openecomp.sdc.destinationprovider.impl;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.openecomp.sdc.notification.services.SubscriptionService;
import java.util.Arrays;
@@ -31,7 +31,10 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doReturn;
@@ -39,6 +42,7 @@ import static org.mockito.Mockito.doReturn;
* @author avrahamg
* @since July 13, 2017
*/
+@ExtendWith(MockitoExtension.class)
public class MulticastDestinationTest {
@Mock
private SubscriptionService subscriptionServiceMock;
@@ -47,10 +51,6 @@ public class MulticastDestinationTest {
private Set<String> subscribers = new HashSet<>(Arrays.asList("a", "b", excludedSubscriber));
private MulticastDestination multicastDestination;
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- }
@Test
public void shouldReturnAllSubscribersIfNoExcludedProvided() throws Exception {
@@ -72,13 +72,11 @@ public class MulticastDestinationTest {
assertFalse(actualSubscribers.contains(excludedSubscriber));
}
- @Test(expected = UnsupportedOperationException.class)
- public void shouldThrowUnsupportedOperationExceptionWhenTryingToChangeSubscribersList() throws
- Exception {
- doReturn(subscribers).when(subscriptionServiceMock).getSubscribers(any());
+ @Test
+ public void entityIdTest() {
multicastDestination =
- new MulticastDestination("aa", subscriptionServiceMock, excludedSubscriber);
- List<String> actualSubscribers = multicastDestination.getSubscribers();
- actualSubscribers.add("sss");
+ new MulticastDestination("aa", subscriptionServiceMock, excludedSubscriber);
+ multicastDestination.setEntityId("entityId");
+ assertEquals("entityId", multicastDestination.getEntityId());
}
}