From 9da6b07ea3f4010b400d0525fb436a923c97dc82 Mon Sep 17 00:00:00 2001 From: sinthuja Date: Tue, 10 Oct 2017 22:23:54 +0530 Subject: [PATCH] setting the config to be null to avoid intermittent failure. --- .../analytics/data/publisher/DataPublisherConfigTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/src/test/java/org/wso2/carbon/device/mgt/analytics/data/publisher/DataPublisherConfigTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/src/test/java/org/wso2/carbon/device/mgt/analytics/data/publisher/DataPublisherConfigTest.java index da1a443676..5f594ef686 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/src/test/java/org/wso2/carbon/device/mgt/analytics/data/publisher/DataPublisherConfigTest.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/src/test/java/org/wso2/carbon/device/mgt/analytics/data/publisher/DataPublisherConfigTest.java @@ -24,6 +24,7 @@ import org.wso2.carbon.device.mgt.analytics.data.publisher.config.InvalidConfigu import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException; import java.io.File; +import java.lang.reflect.Field; import java.net.URL; /** @@ -33,7 +34,10 @@ public class DataPublisherConfigTest extends BaseAnalyticsDataPublisherTest { @Test(description = "Validating the behaviour od getInstance of the config before calling the init", expectedExceptions = InvalidConfigurationStateException.class) - public void testGetInstanceWithoutInit() { + public void testGetInstanceWithoutInit() throws NoSuchFieldException, IllegalAccessException { + Field configField = AnalyticsConfiguration.class.getDeclaredField("config"); + configField.setAccessible(true); + configField.set(configField, null); AnalyticsConfiguration.getInstance(); }