From db3004ab912002824f4f74398aad9c5358d2ea9e Mon Sep 17 00:00:00 2001 From: Asanka Kumara Date: Mon, 27 May 2019 08:40:04 +0000 Subject: [PATCH] Override getDevice methods in DeviceManagementProviderServiceMock --- .../DeviceManagementProviderServiceMock.java | 17 +++++++++++++++++ .../DeviceManagementProviderServiceMock.java | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceManagementProviderServiceMock.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceManagementProviderServiceMock.java index 9ed1b6f0ed..1646af97ea 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceManagementProviderServiceMock.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceManagementProviderServiceMock.java @@ -127,6 +127,15 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv } } + @Override + public Device getDevice(String s, boolean b) throws DeviceManagementException { + if (TestUtils.getDeviceId().equals(s)) { + return TestUtils.getDevice(); + } else { + return null; + } + } + @Override public Device getDevice(DeviceIdentifier deviceIdentifier, String s, boolean b) throws DeviceManagementException { return null; @@ -142,6 +151,14 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv return null; } + @Override + public Device getDevice(String s, Date date, boolean b) throws DeviceManagementException { + if (TestUtils.getDeviceId().equals(s)) { + return TestUtils.getDevice(); + } else { + return null; + } } + @Override public Device getDevice(DeviceIdentifier deviceIdentifier, String s, Date date, boolean b) throws DeviceManagementException { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.v09.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceManagementProviderServiceMock.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.v09.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceManagementProviderServiceMock.java index 9ed1b6f0ed..1646af97ea 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.v09.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceManagementProviderServiceMock.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.v09.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceManagementProviderServiceMock.java @@ -127,6 +127,15 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv } } + @Override + public Device getDevice(String s, boolean b) throws DeviceManagementException { + if (TestUtils.getDeviceId().equals(s)) { + return TestUtils.getDevice(); + } else { + return null; + } + } + @Override public Device getDevice(DeviceIdentifier deviceIdentifier, String s, boolean b) throws DeviceManagementException { return null; @@ -142,6 +151,14 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv return null; } + @Override + public Device getDevice(String s, Date date, boolean b) throws DeviceManagementException { + if (TestUtils.getDeviceId().equals(s)) { + return TestUtils.getDevice(); + } else { + return null; + } } + @Override public Device getDevice(DeviceIdentifier deviceIdentifier, String s, Date date, boolean b) throws DeviceManagementException {