diff options
Diffstat (limited to 'appc-provider/appc-provider-bundle/src/test/java')
-rw-r--r-- | appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/topology/TopologyServiceTest.java | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/topology/TopologyServiceTest.java b/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/topology/TopologyServiceTest.java index f3014e264..a4aed5048 100644 --- a/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/topology/TopologyServiceTest.java +++ b/appc-provider/appc-provider-bundle/src/test/java/org/onap/appc/provider/topology/TopologyServiceTest.java @@ -5,6 +5,8 @@ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs + * ================================================================================ + * Modifications (C) 2019 Ericsson * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +29,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; +import org.mockito.Mockito; import org.opendaylight.yang.gen.v1.org.onap.appc.provider.rev160104.UUID; import org.opendaylight.yang.gen.v1.org.onap.appc.provider.rev160104.common.request.header.CommonRequestHeader; import org.opendaylight.yang.gen.v1.org.onap.appc.provider.rev160104.config.payload.ConfigPayload; @@ -34,21 +37,19 @@ import org.opendaylight.yang.gen.v1.org.onap.appc.provider.rev160104.vnf.resourc import org.onap.appc.configuration.Configuration; import org.onap.appc.configuration.ConfigurationFactory; import org.onap.appc.provider.AppcProvider; -import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; -import static org.mockito.Matchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.internal.verification.VerificationModeFactory.times; import static org.powermock.api.mockito.PowerMockito.mockStatic; import static org.powermock.api.mockito.PowerMockito.spy; -import static org.powermock.api.mockito.PowerMockito.verifyPrivate; import static org.powermock.api.mockito.PowerMockito.when; +import java.util.Properties; @RunWith(PowerMockRunner.class) -@PrepareForTest({TopologyService.class, ConfigurationFactory.class}) +@PrepareForTest(ConfigurationFactory.class) public class TopologyServiceTest { @Mock private AppcProvider appcProvider; @@ -71,11 +72,10 @@ public class TopologyServiceTest { ConfigPayload configPayload = mock(ConfigPayload.class); doReturn("url").when(configPayload).getConfigUrl(); doReturn("configJson").when(configPayload).getConfigJson(); - PowerMockito.doReturn(true).when(topologyService, "callGraph", any()); topologyService.modifyConfig(commonRequestHeader, configPayload); - verifyPrivate(topologyService, times(1)).invoke("callGraph", any()); + Mockito.verify(topologyService, times(1)).callGraph(Mockito.any(Properties.class)); } @Test @@ -86,11 +86,10 @@ public class TopologyServiceTest { UUID uuid = mock(UUID.class); doReturn("uuid-value").when(uuid).getValue(); doReturn(uuid).when(vnfResource).getVmId(); - PowerMockito.doReturn(true).when(topologyService, "callGraph", any()); topologyService.migrate(commonRequestHeader, vnfResource); - verifyPrivate(topologyService, times(1)).invoke("callGraph", any()); + Mockito.verify(topologyService, times(1)).callGraph(Mockito.any(Properties.class)); } @Test @@ -101,11 +100,10 @@ public class TopologyServiceTest { UUID uuid = mock(UUID.class); doReturn("uuid-value").when(uuid).getValue(); doReturn(uuid).when(vnfResource).getVmId(); - PowerMockito.doReturn(true).when(topologyService, "callGraph", any()); topologyService.restart(commonRequestHeader, vnfResource); - verifyPrivate(topologyService, times(1)).invoke("callGraph", any()); + Mockito.verify(topologyService, times(1)).callGraph(Mockito.any(Properties.class)); } @Test @@ -116,11 +114,10 @@ public class TopologyServiceTest { UUID uuid = mock(UUID.class); doReturn("uuid-value").when(uuid).getValue(); doReturn(uuid).when(vnfResource).getVmId(); - PowerMockito.doReturn(true).when(topologyService, "callGraph", any()); topologyService.rebuild(commonRequestHeader, vnfResource); - verifyPrivate(topologyService, times(1)).invoke("callGraph", any()); + Mockito.verify(topologyService, times(1)).callGraph(Mockito.any(Properties.class)); } @Test @@ -131,11 +128,10 @@ public class TopologyServiceTest { UUID uuid = mock(UUID.class); doReturn("uuid-value").when(uuid).getValue(); doReturn(uuid).when(vnfResource).getVmId(); - PowerMockito.doReturn(true).when(topologyService, "callGraph", any()); topologyService.snapshot(commonRequestHeader, vnfResource); - verifyPrivate(topologyService, times(1)).invoke("callGraph", any()); + Mockito.verify(topologyService, times(1)).callGraph(Mockito.any(Properties.class)); } @Test @@ -146,11 +142,10 @@ public class TopologyServiceTest { UUID uuid = mock(UUID.class); doReturn("uuid-value").when(uuid).getValue(); doReturn(uuid).when(vnfResource).getVmId(); - PowerMockito.doReturn(true).when(topologyService, "callGraph", any()); topologyService.vmstatuscheck(commonRequestHeader, vnfResource); - verifyPrivate(topologyService, times(1)).invoke("callGraph", any()); + Mockito.verify(topologyService, times(1)).callGraph(Mockito.any(Properties.class)); } }
\ No newline at end of file |