X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=networkmodel%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fnetworkmodel%2Flisteners%2FDeviceListener121Test.java;h=efe1d28943f5750a1f5e6e481d6108a5db3a307c;hb=6bc844fe96e1bd2ae991f5a1b2ad3f7446f87f10;hp=a862a02d764cff8a21b36e0dd501e38f5db1fbe8;hpb=c10e4140f3cc89f7b4d635d7a370209d8a1e15ff;p=transportpce.git diff --git a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/listeners/DeviceListener121Test.java b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/listeners/DeviceListener121Test.java index a862a02d7..efe1d2894 100644 --- a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/listeners/DeviceListener121Test.java +++ b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/listeners/DeviceListener121Test.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.rev170206.ChangeNotification; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceData; import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.change.notification.Edit; import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.change.notification.EditBuilder; import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.Ports; @@ -34,13 +35,13 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.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 DeviceListener121Test { @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 DeviceListener121Test { } @Test - public void testOnChangeNotificationWhenNoEditList() { + void testOnChangeNotificationWhenNoEditList() { ChangeNotification notification = mock(ChangeNotification.class); when(notification.getEdit()).thenReturn(null); DeviceListener121 listener = new DeviceListener121("node1", portMapping); @@ -65,7 +66,7 @@ public class DeviceListener121Test { } @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 DeviceListener121Test { } 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 DeviceListener121Test { } 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)