You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2023/01/03 09:12:43 UTC
[streampipes] branch SP-1026 updated: [#1026] Fix junit tests in streampipes-connect-management
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch SP-1026
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/SP-1026 by this push:
new 069bfc8d0 [#1026] Fix junit tests in streampipes-connect-management
069bfc8d0 is described below
commit 069bfc8d0555dad1ab95a1cb5a660aae6eb29a02
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Tue Jan 3 10:09:07 2023 +0100
[#1026] Fix junit tests in streampipes-connect-management
---
streampipes-connect-management/pom.xml | 10 --
.../management/health/AdapterHealthCheckTest.java | 122 ------------------
.../management/AdapterMasterManagementTest.java | 5 +-
.../management/DescriptionManagementTest.java | 65 ----------
.../management/UnitMasterManagementTest.java | 128 -------------------
.../management/WorkerRestClientTest.java | 141 ---------------------
6 files changed, 2 insertions(+), 469 deletions(-)
diff --git a/streampipes-connect-management/pom.xml b/streampipes-connect-management/pom.xml
index 60c3ae026..84d8e076a 100644
--- a/streampipes-connect-management/pom.xml
+++ b/streampipes-connect-management/pom.xml
@@ -79,16 +79,6 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-junit4</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito2</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
diff --git a/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/health/AdapterHealthCheckTest.java b/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/health/AdapterHealthCheckTest.java
deleted file mode 100644
index 7e928bd71..000000000
--- a/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/health/AdapterHealthCheckTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.streampipes.connect.management.health;
-
-import org.apache.streampipes.connect.management.management.AdapterMasterManagement;
-import org.apache.streampipes.extensions.api.connect.exception.AdapterException;
-import org.apache.streampipes.model.connect.adapter.AdapterDescription;
-import org.apache.streampipes.model.connect.adapter.AdapterStreamDescription;
-import org.apache.streampipes.model.connect.adapter.SpecificAdapterStreamDescription;
-import org.apache.streampipes.sdk.builder.adapter.SpecificDataStreamAdapterBuilder;
-import org.apache.streampipes.storage.couchdb.impl.AdapterInstanceStorageImpl;
-
-import org.junit.Test;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.powermock.api.mockito.PowerMockito.mock;
-import static org.powermock.api.mockito.PowerMockito.when;
-
-public class AdapterHealthCheckTest {
-
- private final String testElementId = "testElementId";
-
- @Test
- public void getAllRunningInstancesAdapterDescriptions() {
- AdapterInstanceStorageImpl adapterStorage = mock(AdapterInstanceStorageImpl.class);
- when(adapterStorage.getAllAdapters()).thenReturn(getAdapterDescriptionList());
-
- AdapterHealthCheck adapterHealthCheck = new AdapterHealthCheck(adapterStorage, null);
- Map<String, AdapterDescription> result = adapterHealthCheck.getAllRunningInstancesAdapterDescriptions();
-
- assertNotNull(result);
- assertEquals(1, result.keySet().size());
- assertEquals(getAdapterDescriptionList().get(0), result.get(testElementId));
- }
-
- @Test
- public void getAllWorkersWithAdapters() {
- AdapterInstanceStorageImpl adapterStorage = mock(AdapterInstanceStorageImpl.class);
- when(adapterStorage.getAllAdapters()).thenReturn(getAdapterDescriptionList());
-
- AdapterHealthCheck adapterHealthCheck = new AdapterHealthCheck(null, null);
- Map<String, List<AdapterDescription>> result =
- adapterHealthCheck.getAllWorkersWithAdapters(getAdapterDescriptionMap());
-
- assertNotNull(result);
- assertEquals(1, result.keySet().size());
- String selectedEndpointUrl = "http://test.de";
- assertEquals(1, result.get(selectedEndpointUrl).size());
- assertEquals(getAdapterDescriptionList().get(0), result.get(selectedEndpointUrl).get(0));
- }
-
- @Test
- public void recoverRunningAdaptersTest() throws AdapterException {
- AdapterMasterManagement adapterMasterManagementMock = mock(AdapterMasterManagement.class);
- AdapterHealthCheck adapterHealthCheck = new AdapterHealthCheck(null, adapterMasterManagementMock);
-
- adapterHealthCheck.recoverAdapters(getAdaptersToRecoverData(true));
-
- verify(adapterMasterManagementMock, times(1)).startStreamAdapter(any());
- }
-
-
- @Test
- public void recoverStoppedAdaptersTest() throws AdapterException {
- AdapterMasterManagement adapterMasterManagementMock = mock(AdapterMasterManagement.class);
- AdapterHealthCheck adapterHealthCheck = new AdapterHealthCheck(null, adapterMasterManagementMock);
-
- adapterHealthCheck.recoverAdapters(getAdaptersToRecoverData(false));
-
- verify(adapterMasterManagementMock, times(0)).startStreamAdapter(any());
- }
-
- private Map<String, AdapterDescription> getAdaptersToRecoverData(boolean isRunning) {
- Map<String, AdapterDescription> adaptersToRecover = new HashMap<>();
- AdapterStreamDescription ad = SpecificDataStreamAdapterBuilder.create("").build();
- ad.setRunning(isRunning);
- adaptersToRecover.put("", ad);
- return adaptersToRecover;
- }
-
- private List<AdapterDescription> getAdapterDescriptionList() {
-
- SpecificAdapterStreamDescription adapterStreamDescription = SpecificDataStreamAdapterBuilder
- .create("testAppId", "Test Adapter", "")
- .elementId(testElementId)
- .build();
- adapterStreamDescription.setSelectedEndpointUrl("http://test.de");
-
- return List.of(adapterStreamDescription);
- }
-
- private Map<String, AdapterDescription> getAdapterDescriptionMap() {
- Map<String, AdapterDescription> result = new HashMap<>();
- result.put(testElementId, getAdapterDescriptionList().get(0));
-
- return result;
- }
-
-}
diff --git a/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/management/AdapterMasterManagementTest.java b/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/management/AdapterMasterManagementTest.java
index 4b2a42678..0ad8170a6 100644
--- a/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/management/AdapterMasterManagementTest.java
+++ b/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/management/AdapterMasterManagementTest.java
@@ -26,7 +26,6 @@ import org.apache.streampipes.storage.couchdb.impl.AdapterInstanceStorageImpl;
import org.junit.Test;
-import java.util.Arrays;
import java.util.List;
import static org.junit.Assert.assertEquals;
@@ -49,7 +48,7 @@ public class AdapterMasterManagementTest {
@Test(expected = AdapterException.class)
public void getAdapterFail() throws AdapterException {
- List<AdapterDescription> adapterDescriptions = Arrays.asList(new GenericAdapterStreamDescription());
+ List<AdapterDescription> adapterDescriptions = List.of(new GenericAdapterStreamDescription());
AdapterInstanceStorageImpl adapterStorage = mock(AdapterInstanceStorageImpl.class);
AdapterResourceManager resourceManager = mock(AdapterResourceManager.class);
when(adapterStorage.getAllAdapters()).thenReturn(adapterDescriptions);
@@ -62,7 +61,7 @@ public class AdapterMasterManagementTest {
@Test
public void getAllAdaptersSuccess() throws AdapterException {
- List<AdapterDescription> adapterDescriptions = Arrays.asList(new GenericAdapterStreamDescription());
+ List<AdapterDescription> adapterDescriptions = List.of(new GenericAdapterStreamDescription());
AdapterInstanceStorageImpl adapterStorage = mock(AdapterInstanceStorageImpl.class);
AdapterResourceManager resourceManager = mock(AdapterResourceManager.class);
when(adapterStorage.getAllAdapters()).thenReturn(adapterDescriptions);
diff --git a/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/management/DescriptionManagementTest.java b/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/management/DescriptionManagementTest.java
deleted file mode 100644
index 485ff04c9..000000000
--- a/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/management/DescriptionManagementTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.connect.management.management;
-
-import org.apache.streampipes.extensions.api.connect.IFormat;
-import org.apache.streampipes.extensions.management.connect.adapter.AdapterRegistry;
-import org.apache.streampipes.extensions.management.connect.adapter.format.json.arraykey.JsonFormat;
-import org.apache.streampipes.model.connect.grounding.FormatDescription;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({AdapterRegistry.class})
-@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"})
-public class DescriptionManagementTest {
-
-
- @Test
- public void getFormats() {
- Map<String, IFormat> allFormats = new HashMap<>();
- allFormats.put(JsonFormat.ID, new JsonFormat());
-
- PowerMockito.mockStatic(AdapterRegistry.class);
- Mockito.when(AdapterRegistry.getAllFormats())
- .thenReturn(allFormats);
-
- DescriptionManagement descriptionManagement = new DescriptionManagement();
-
- List<FormatDescription> result = descriptionManagement.getFormats();
-
- assertNotNull(result);
- assertEquals(1, result.size());
- assertEquals(JsonFormat.ID, result.get(0).getAppId());
- }
-
-}
diff --git a/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/management/UnitMasterManagementTest.java b/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/management/UnitMasterManagementTest.java
deleted file mode 100644
index 722c97e39..000000000
--- a/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/management/UnitMasterManagementTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.connect.management.management;
-
-import org.apache.streampipes.extensions.api.connect.exception.AdapterException;
-import org.apache.streampipes.model.connect.unit.UnitDescription;
-import org.apache.streampipes.units.UnitProvider;
-
-import com.github.jqudt.Unit;
-import com.github.jqudt.onto.UnitFactory;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.powermock.reflect.Whitebox;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.powermock.api.mockito.PowerMockito.mock;
-import static org.powermock.api.mockito.PowerMockito.when;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({UnitProvider.class, UnitFactory.class})
-@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"})
-public class UnitMasterManagementTest {
-
- @Test(expected = AdapterException.class)
- public void urlIsNull() throws AdapterException {
- UnitMasterManagement unitMasterManagement = new UnitMasterManagement();
- unitMasterManagement.getFittingUnits(getUnitDescription("", null));
- }
-
- @Test(expected = AdapterException.class)
- @Ignore
- public void invalidURL() throws AdapterException {
- UnitProvider unitProvider = mock(UnitProvider.INSTANCE.getClass());
- when(unitProvider.getUnit(anyString())).thenThrow(new IllegalStateException());
-
- UnitMasterManagement unitMasterManagement = new UnitMasterManagement();
- unitMasterManagement.getFittingUnits(getUnitDescription("", "http://test"));
- }
-
- @Test
- public void getFittingUnitsEmpty() throws Exception {
- UnitProvider unitProvider = mock(UnitProvider.INSTANCE.getClass());
- when(unitProvider.getUnit(anyString())).thenReturn(new Unit());
- when(unitProvider.getUnitsByType(any())).thenReturn((new ArrayList<>()));
- Whitebox.setInternalState(UnitProvider.class, "INSTANCE", unitProvider);
-
- UnitMasterManagement unitMasterManagement = new UnitMasterManagement();
- String jsonResult = unitMasterManagement.getFittingUnits(getUnitDescription("", ""));
- assertEquals("[]", jsonResult);
- }
-
- @Test
- public void getFittingUnitsUnitsEmpty() throws Exception {
- UnitProvider unitProvider = mock(UnitProvider.INSTANCE.getClass());
- when(unitProvider.getUnit(anyString())).thenReturn(new Unit());
-
- List<Unit> unitList = new ArrayList<>(2);
- unitList.add(new Unit());
- unitList.add(new Unit());
-
- when(unitProvider.getUnitsByType(any())).thenReturn((unitList));
- Whitebox.setInternalState(UnitProvider.class, "INSTANCE", unitProvider);
-
- UnitMasterManagement unitMasterManagement = new UnitMasterManagement();
- String jsonResult = unitMasterManagement.getFittingUnits(getUnitDescription("", ""));
- assertEquals("[]", jsonResult);
- }
-
- @Test
- public void getFittingUnitsUnits() throws Exception {
- UnitProvider unitProvider = mock(UnitProvider.INSTANCE.getClass());
- when(unitProvider.getUnit(anyString())).thenReturn(new Unit());
-
- List<Unit> unitList = new ArrayList<>(2);
- Unit unit = new Unit();
- unit.setLabel("A");
- unit.setResource(new URI("http://A"));
- unitList.add(unit);
- unit = new Unit();
- unit.setLabel("A");
- unit.setResource(new URI("http://A"));
- unitList.add(unit);
- unitList.add(new Unit());
-
- when(unitProvider.getUnitsByType(any())).thenReturn((unitList));
- Whitebox.setInternalState(UnitProvider.class, "INSTANCE", unitProvider);
-
- UnitMasterManagement unitMasterManagement = new UnitMasterManagement();
- String jsonResult = unitMasterManagement.getFittingUnits(getUnitDescription("", ""));
- assertEquals("[{\"resource\":\"http://A\",\"label\":\"A\"},{\"resource\":\"http://A\",\"label\":\"A\"}]",
- jsonResult);
- }
-
-
- private UnitDescription getUnitDescription(String label, String ressource) {
- UnitDescription unitDescription = new UnitDescription();
- unitDescription.setLabel(label);
- unitDescription.setResource(ressource);
- return unitDescription;
- }
-
-}
diff --git a/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/management/WorkerRestClientTest.java b/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/management/WorkerRestClientTest.java
deleted file mode 100644
index b89ebfc0c..000000000
--- a/streampipes-connect-management/src/test/java/org/apache/streampipes/connect/management/management/WorkerRestClientTest.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.streampipes.connect.management.management;
-
-import org.apache.streampipes.connect.management.util.WorkerPaths;
-import org.apache.streampipes.extensions.api.connect.exception.AdapterException;
-import org.apache.streampipes.model.connect.adapter.GenericAdapterSetDescription;
-import org.apache.streampipes.model.connect.adapter.GenericAdapterStreamDescription;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.times;
-import static org.powermock.api.mockito.PowerMockito.doNothing;
-import static org.powermock.api.mockito.PowerMockito.doThrow;
-import static org.powermock.api.mockito.PowerMockito.verifyStatic;
-import static org.powermock.api.mockito.PowerMockito.when;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({WorkerRestClient.class, WorkerPaths.class})
-@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"})
-public class WorkerRestClientTest {
-
- /**
- * Notes: In this class I tested how powermock could be used to mok static methods
- * One problem is to mock static methods that return void
- */
-
- @Before
- public void before() {
- PowerMockito.mockStatic(WorkerRestClient.class);
- PowerMockito.mockStatic(WorkerPaths.class);
- }
-
- @Test
- public void stopStreamAdapterSuccess() throws Exception {
-
- String expectedUrl = "worker/stream/stop";
- doNothing().when(WorkerRestClient.class, "stopAdapter", any(), anyString());
- when(WorkerRestClient.class, "stopStreamAdapter", anyString(), any()).thenCallRealMethod();
- when(WorkerPaths.class, "getStreamStopPath").thenReturn(expectedUrl);
- GenericAdapterStreamDescription description = new GenericAdapterStreamDescription();
- description.setElementId("id1");
-
- WorkerRestClient.stopStreamAdapter("", description);
-
- verifyStatic(WorkerRestClient.class, times(1));
- WorkerRestClient.stopAdapter(any(), eq(expectedUrl));
-
- }
-
- @Test(expected = AdapterException.class)
- public void stopStreamAdapterFail() throws Exception {
- doThrow(new AdapterException()).when(WorkerRestClient.class, "stopAdapter", any(), anyString());
- when(WorkerRestClient.class, "stopStreamAdapter", anyString(), any()).thenCallRealMethod();
-
- GenericAdapterStreamDescription description = new GenericAdapterStreamDescription();
- description.setElementId("id1");
-
- WorkerRestClient.stopStreamAdapter("", description);
-
- }
-
- @Test
- public void invokeSetAdapterSuccess() throws Exception {
-
- String expectedUrl = "worker/set/invoke";
- doNothing().when(WorkerRestClient.class, "startAdapter", anyString(), any());
- when(WorkerRestClient.class, "invokeSetAdapter", anyString(), any()).thenCallRealMethod();
- when(WorkerPaths.class, "getSetInvokePath").thenReturn(expectedUrl);
-
- GenericAdapterSetDescription description = new GenericAdapterSetDescription();
- description.setElementId("id1");
- WorkerRestClient.invokeSetAdapter("", description);
-
- verifyStatic(WorkerRestClient.class, times(1));
- WorkerRestClient.startAdapter(eq("worker/set/invoke"), any());
-
- }
-
- @Test(expected = AdapterException.class)
- public void invokeSetAdapterFail() throws Exception {
- doThrow(new AdapterException()).when(WorkerRestClient.class, "startAdapter", anyString(), any());
- when(WorkerRestClient.class, "invokeSetAdapter", anyString(), any()).thenCallRealMethod();
-
- WorkerRestClient.invokeSetAdapter("", null);
- }
-
- @Test
- public void stopSetAdapterSuccess() throws Exception {
-
- String expectedUrl = "worker/set/stop";
- doNothing().when(WorkerRestClient.class, "stopAdapter", any(), anyString());
- when(WorkerRestClient.class, "stopSetAdapter", anyString(), any()).thenCallRealMethod();
- when(WorkerPaths.class, "getSetStopPath").thenReturn(expectedUrl);
-
- GenericAdapterSetDescription description = new GenericAdapterSetDescription();
- description.setElementId("id1");
- WorkerRestClient.stopSetAdapter("", description);
-
- verifyStatic(WorkerRestClient.class, times(1));
- WorkerRestClient.stopAdapter(any(), eq(expectedUrl));
-
- }
-
- @Test(expected = AdapterException.class)
- public void stopSetAdapterFail() throws Exception {
- doThrow(new AdapterException()).when(WorkerRestClient.class, "stopAdapter", any(), anyString());
- when(WorkerRestClient.class, "stopSetAdapter", anyString(), any()).thenCallRealMethod();
-
- GenericAdapterSetDescription description = new GenericAdapterSetDescription();
- description.setElementId("id1");
- WorkerRestClient.stopSetAdapter("", description);
-
- }
-
-}