X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=networkmodel%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fnetworkmodel%2Flisteners%2FDeviceListener221Test.java;h=1779399df0d06418ad7a3c7b3d81be3b31aedf3f;hb=6bc844fe96e1bd2ae991f5a1b2ad3f7446f87f10;hp=824c82e3c17258197c1aae956c89a1015f66f518;hpb=c10e4140f3cc89f7b4d635d7a370209d8a1e15ff;p=transportpce.git diff --git a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/listeners/DeviceListener221Test.java b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/listeners/DeviceListener221Test.java index 824c82e3c..1779399df 100644 --- a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/listeners/DeviceListener221Test.java +++ b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/listeners/DeviceListener221Test.java @@ -17,13 +17,14 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import com.google.common.collect.ImmutableList; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; +import org.mockito.junit.jupiter.MockitoExtension; import org.opendaylight.transportpce.common.mapping.PortMapping; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220114.mapping.Mapping; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping; import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.ChangeNotification; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceData; import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.change.notification.Edit; import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.change.notification.EditBuilder; import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.circuit.pack.Ports; @@ -34,13 +35,13 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.open import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.EditOperationType; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -@RunWith(MockitoJUnitRunner.StrictStubs.class) +@ExtendWith(MockitoExtension.class) public class DeviceListener221Test { @Mock private PortMapping portMapping; @Test - public void testOnChangeNotificationWhenPortUpdated() throws InterruptedException { + void testOnChangeNotificationWhenPortUpdated() throws InterruptedException { ChangeNotification notification = mock(ChangeNotification.class); Mapping oldMapping = mock(Mapping.class); ImmutableList editList = createEditList(); @@ -55,7 +56,7 @@ public class DeviceListener221Test { } @Test - public void testOnChangeNotificationWhenNoEditList() { + void testOnChangeNotificationWhenNoEditList() { ChangeNotification notification = mock(ChangeNotification.class); when(notification.getEdit()).thenReturn(null); DeviceListener221 listener = new DeviceListener221("node1", portMapping); @@ -65,7 +66,7 @@ public class DeviceListener221Test { } @Test - public void testOnChangeNotificationWhenOtherthingUpdated() { + void testOnChangeNotificationWhenOtherthingUpdated() { ChangeNotification notification = mock(ChangeNotification.class); ImmutableList editList = createBadEditList(); when(notification.getEdit()).thenReturn(editList); @@ -76,9 +77,11 @@ public class DeviceListener221Test { } private ImmutableList createEditList() { - InstanceIdentifier portId = InstanceIdentifier.create(OrgOpenroadmDevice.class) + InstanceIdentifier portId = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) .child(CircuitPacks.class, new CircuitPacksKey("circuit-pack1")) - .child(Ports.class, new PortsKey("port1")); + .child(Ports.class, new PortsKey("port1")) + .build(); Edit edit = new EditBuilder() .setOperation(EditOperationType.Merge) .setTarget(portId) @@ -88,8 +91,10 @@ public class DeviceListener221Test { } private ImmutableList createBadEditList() { - InstanceIdentifier cpId = InstanceIdentifier.create(OrgOpenroadmDevice.class) - .child(CircuitPacks.class, new CircuitPacksKey("circuit-pack1")); + InstanceIdentifier cpId = InstanceIdentifier + .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class) + .child(CircuitPacks.class, new CircuitPacksKey("circuit-pack1")) + .build(); Edit edit = new EditBuilder() .setOperation(EditOperationType.Merge) .setTarget(cpId)