increasing test coverage in common-app-api fe catalog 87/94187/4
authorBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Fri, 23 Aug 2019 08:22:21 +0000 (10:22 +0200)
committerTomasz Golabek <tomasz.golabek@nokia.com>
Fri, 23 Aug 2019 11:32:49 +0000 (11:32 +0000)
Issue-ID: SDC-2326
Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Change-Id: Ib4ca69ef881ea5db4f1d186b00f9a1cfbc603259

common-app-api/src/main/java/org/openecomp/sdc/fe/config/ConfigurationManager.java
common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConfigurationManagerTest.java [new file with mode: 0644]
common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConfigurationTest.java
common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConnectionTest.java [new file with mode: 0644]
common-app-api/src/test/java/org/openecomp/sdc/fe/config/FeEcompErrorManagerTest.java [new file with mode: 0644]
common-app-api/src/test/java/org/openecomp/sdc/fe/config/PluginsConfigurationTest.java [new file with mode: 0644]

index 9353dd9..aafbdc7 100644 (file)
@@ -110,19 +110,7 @@ public class ConfigurationManager implements FileChangeCallback, IEcompConfigura
 
     }
 
-    public void reconfigure(BasicConfiguration obj) {
-        //
-        // if (obj != null) {
-        //
-        // if (obj instanceof Configuration) {
-        // configurations.put(getKey(Configuration.class), obj);
-        // }
-        //
-        // if (obj instanceof EcompErrorConfiguration) {
-        // configurations.put(getKey(EcompErrorConfiguration.class), obj);
-        // }
-        // }
-    }
+    public void reconfigure(BasicConfiguration obj) { }
 
     public static ConfigurationManager getConfigurationManager() {
         return instance;
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConfigurationManagerTest.java b/common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConfigurationManagerTest.java
new file mode 100644 (file)
index 0000000..a0c19b3
--- /dev/null
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.fe.config;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.openecomp.sdc.common.api.ConfigurationListener;
+import org.openecomp.sdc.common.api.ConfigurationSource;
+import org.openecomp.sdc.common.config.EcompErrorConfiguration;
+import org.openecomp.sdc.common.rest.api.RestConfigurationInfo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ConfigurationManagerTest {
+
+    private ConfigurationManager configurationManager;
+
+    @Mock
+    private ConfigurationSource configurationSource;
+
+    private class TestConfiguration extends Configuration {}
+    private class TestPluginsConfiguration extends PluginsConfiguration {}
+    private class TestRestConfigurationInfo extends RestConfigurationInfo {}
+    private class TestEcompErrorConfiguration extends EcompErrorConfiguration {}
+
+    @Test
+    public void validateConfigurationManageIsConstructWithAllConfiguration() {
+        when(configurationSource.
+                getAndWatchConfiguration(eq(Configuration.class),any(ConfigurationListener.class))
+        ).thenReturn(new TestConfiguration());
+        when(configurationSource.
+                getAndWatchConfiguration(eq(PluginsConfiguration.class),any(ConfigurationListener.class))
+        ).thenReturn(new TestPluginsConfiguration());
+        when(configurationSource.
+                getAndWatchConfiguration(eq(RestConfigurationInfo.class),any(ConfigurationListener.class))
+        ).thenReturn(new TestRestConfigurationInfo());
+        when(configurationSource.
+                getAndWatchConfiguration(eq(EcompErrorConfiguration.class),any(ConfigurationListener.class))
+        ).thenReturn(new TestEcompErrorConfiguration());
+
+        configurationManager = new ConfigurationManager(configurationSource);
+
+        assertEquals(configurationManager.getConfiguration().getClass(),TestConfiguration.class);
+        assertEquals(configurationManager.getPluginsConfiguration().getClass(), TestPluginsConfiguration.class);
+        assertEquals(configurationManager.getRestClientConfiguration().getClass(), TestRestConfigurationInfo.class);
+        assertEquals(configurationManager.getEcompErrorConfiguration().getClass(), TestEcompErrorConfiguration.class);
+    }
+
+    @Test
+    public void validateGetConfigurationAndWatchCallsWatchOnNewConfiguration() {
+        when(configurationSource.
+                getAndWatchConfiguration(eq(Configuration.class),any(ConfigurationListener.class))
+        ).thenReturn(new TestConfiguration());
+        ConfigurationListener configurationListener = Mockito.mock(ConfigurationListener.class);
+
+        configurationManager = new ConfigurationManager(configurationSource);
+        Configuration result = configurationManager.getConfigurationAndWatch(configurationListener);
+
+        assertEquals(result.getClass(),TestConfiguration.class);
+        verify(configurationSource).addWatchConfiguration(eq(Configuration.class),eq(configurationListener));
+    }
+
+    @Test
+    public void validateGetSetInstance() {
+        when(configurationSource.
+                getAndWatchConfiguration(eq(Configuration.class),any(ConfigurationListener.class))
+        ).thenReturn(new TestConfiguration());
+
+        configurationManager = new ConfigurationManager(configurationSource);
+        assertEquals(ConfigurationManager.getConfigurationManager(),configurationManager);
+        ConfigurationManager.setTestInstance(null);
+        assertNull(ConfigurationManager.getConfigurationManager());
+    }
+}
index a6c7ce8..1968e4b 100644 (file)
@@ -3,6 +3,7 @@
  * SDC
  * ================================================================================
  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nokia.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 package org.openecomp.sdc.fe.config;
 
 import org.junit.Test;
-import org.openecomp.sdc.fe.config.Configuration.FeMonitoringConfig;
 
-import java.util.Date;
-import java.util.List;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
 
 
 public class ConfigurationTest {
 
-       private Configuration createTestSubject() {
-               return new Configuration();
-       }
-
-       
        @Test
-       public void testGetKibanaProtocol() throws Exception {
-               Configuration testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getKibanaProtocol();
+       public void validateBean() {
+               assertThat(Configuration.class, allOf(
+                               hasValidBeanConstructor(),
+                               hasValidGettersAndSetters()
+               ));
        }
 
-       
        @Test
-       public void testSetKibanaProtocol() throws Exception {
-               Configuration testSubject;
-               String kibanaProtocol = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setKibanaProtocol(kibanaProtocol);
+       public void validateFeMonitoringConfigBean() {
+               assertThat(Configuration.FeMonitoringConfig.class, allOf(
+                               hasValidBeanConstructor(),
+                               hasValidGettersAndSetters()
+               ));
        }
 
-       
        @Test
-       public void testGetKibanaHost() throws Exception {
-               Configuration testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getKibanaHost();
+       public void validateOnboardingConfigBean() {
+               assertThat(Configuration.OnboardingConfig.class, allOf(
+                               hasValidBeanConstructor(),
+                               hasValidGettersAndSetters()
+               ));
        }
 
-       
        @Test
-       public void testSetKibanaHost() throws Exception {
-               Configuration testSubject;
-               String kibanaHost = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setKibanaHost(kibanaHost);
+       public void validateDcaeConfigBean() {
+               assertThat(Configuration.DcaeConfig.class, allOf(
+                               hasValidBeanConstructor(),
+                               hasValidGettersAndSetters()
+               ));
        }
 
-       
        @Test
-       public void testGetKibanaPort() throws Exception {
-               Configuration testSubject;
-               Integer result;
+       public void validateGetHealthCheckSocketTimeoutInMsReturnsProperTime() {
+               final int defaultTestTimeout = 100;
+               final int setTestTimeout = 1000;
+               Configuration configuration = new Configuration();
 
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getKibanaPort();
-       }
-
-       
-       @Test
-       public void testSetKibanaPort() throws Exception {
-               Configuration testSubject;
-               Integer kibanaPort = 0;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setKibanaPort(kibanaPort);
-       }
-
-       
-       @Test
-       public void testGetSystemMonitoring() throws Exception {
-               Configuration testSubject;
-               FeMonitoringConfig result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getSystemMonitoring();
-       }
-
-       
-       @Test
-       public void testSetSystemMonitoring() throws Exception {
-               Configuration testSubject;
-               FeMonitoringConfig systemMonitoring = null;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setSystemMonitoring(systemMonitoring);
-       }
-
-       
-       @Test
-       public void testGetHealthCheckSocketTimeoutInMs() throws Exception {
-               Configuration testSubject;
-               Integer result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getHealthCheckSocketTimeoutInMs();
-       }
-
-       
-       @Test
-       public void testGetHealthCheckSocketTimeoutInMs_1() throws Exception {
-               Configuration testSubject;
-               int defaultVal = 0;
-               Integer result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getHealthCheckSocketTimeoutInMs(defaultVal);
-       }
-
-       
-       @Test
-       public void testSetHealthCheckSocketTimeoutInMs() throws Exception {
-               Configuration testSubject;
-               Integer healthCheckSocketTimeout = 0;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setHealthCheckSocketTimeoutInMs(healthCheckSocketTimeout);
-       }
-
-       
-       @Test
-       public void testGetHealthCheckIntervalInSeconds() throws Exception {
-               Configuration testSubject;
-               Integer result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getHealthCheckIntervalInSeconds();
-       }
-
-       
-       @Test
-       public void testGetHealthCheckIntervalInSeconds_1() throws Exception {
-               Configuration testSubject;
-               int defaultVal = 0;
-               Integer result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getHealthCheckIntervalInSeconds(defaultVal);
-       }
-
-       
-       @Test
-       public void testSetHealthCheckIntervalInSeconds() throws Exception {
-               Configuration testSubject;
-               Integer healthCheckInterval = 0;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setHealthCheckIntervalInSeconds(healthCheckInterval);
-       }
-
-       
-       @Test
-       public void testGetReleased() throws Exception {
-               Configuration testSubject;
-               Date result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getReleased();
-       }
-
-       
-       @Test
-       public void testGetVersion() throws Exception {
-               Configuration testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getVersion();
-       }
-
-       
-       @Test
-       public void testSetReleased() throws Exception {
-               Configuration testSubject;
-               Date released = null;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setReleased(released);
-       }
-
-       
-       @Test
-       public void testSetVersion() throws Exception {
-               Configuration testSubject;
-               String version = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setVersion(version);
-       }
-
-       
-       @Test
-       public void testGetConnection() throws Exception {
-               Configuration testSubject;
-               Connection result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getConnection();
-       }
-
-       
-       @Test
-       public void testSetConnection() throws Exception {
-               Configuration testSubject;
-               Connection connection = null;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setConnection(connection);
-       }
-
-       
-       @Test
-       public void testGetProtocols() throws Exception {
-               Configuration testSubject;
-               List<String> result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getProtocols();
-       }
-
-       
-       @Test
-       public void testSetProtocols() throws Exception {
-               Configuration testSubject;
-               List<String> protocols = null;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setProtocols(protocols);
-       }
-
-       
-       @Test
-       public void testGetBeHost() throws Exception {
-               Configuration testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getBeHost();
-       }
-
-       
-       @Test
-       public void testSetBeHost() throws Exception {
-               Configuration testSubject;
-               String beHost = "";
+               assertEquals(configuration.getHealthCheckSocketTimeoutInMs(defaultTestTimeout).intValue(),defaultTestTimeout);
 
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setBeHost(beHost);
+               configuration.setHealthCheckSocketTimeoutInMs(setTestTimeout);
+               assertEquals(configuration.getHealthCheckSocketTimeoutInMs(defaultTestTimeout).intValue(),setTestTimeout);
        }
 
-       
        @Test
-       public void testGetBeHttpPort() throws Exception {
-               Configuration testSubject;
-               Integer result;
+       public void validateGetHealthCheckIntervalInSecondsReturnsProperTime() {
+               final int defaultTestTimeout = 1;
+               final int setTestTimeout = 2;
+               Configuration configuration = new Configuration();
 
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getBeHttpPort();
-       }
-
-       
-       @Test
-       public void testSetBeHttpPort() throws Exception {
-               Configuration testSubject;
-               Integer beHttpPort = 0;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setBeHttpPort(beHttpPort);
-       }
-
-       
-       @Test
-       public void testGetBeSslPort() throws Exception {
-               Configuration testSubject;
-               Integer result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getBeSslPort();
-       }
-
-       
-       @Test
-       public void testSetBeSslPort() throws Exception {
-               Configuration testSubject;
-               Integer beSslPort = 0;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setBeSslPort(beSslPort);
-       }
-
-       
-       @Test
-       public void testGetBeContext() throws Exception {
-               Configuration testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getBeContext();
-       }
-
-       
-       @Test
-       public void testSetBeContext() throws Exception {
-               Configuration testSubject;
-               String beContext = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setBeContext(beContext);
-       }
-
-       
-       @Test
-       public void testGetBeProtocol() throws Exception {
-               Configuration testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getBeProtocol();
-       }
-
-       
-       @Test
-       public void testSetBeProtocol() throws Exception {
-               Configuration testSubject;
-               String beProtocol = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setBeProtocol(beProtocol);
-       }
-
-       
-       @Test
-       public void testGetThreadpoolSize() throws Exception {
-               Configuration testSubject;
-               int result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getThreadpoolSize();
-       }
-
-       
-       @Test
-       public void testSetThreadpoolSize() throws Exception {
-               Configuration testSubject;
-               int threadpoolSize = 0;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setThreadpoolSize(threadpoolSize);
-       }
-
-       
-       @Test
-       public void testGetRequestTimeout() throws Exception {
-               Configuration testSubject;
-               int result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getRequestTimeout();
-       }
-
-       
-       @Test
-       public void testSetRequestTimeout() throws Exception {
-               Configuration testSubject;
-               int requestTimeout = 0;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setRequestTimeout(requestTimeout);
-       }
-
-       
-       @Test
-       public void testGetIdentificationHeaderFields() throws Exception {
-               Configuration testSubject;
-               List<List<String>> result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getIdentificationHeaderFields();
-       }
-
-       
-       @Test
-       public void testSetIdentificationHeaderFields() throws Exception {
-               Configuration testSubject;
-               List<List<String>> identificationHeaderFields = null;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setIdentificationHeaderFields(identificationHeaderFields);
-       }
-
-       
-       @Test
-       public void testGetOptionalHeaderFields() throws Exception {
-               Configuration testSubject;
-               List<List<String>> result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getOptionalHeaderFields();
-       }
-
-       
-       @Test
-       public void testSetOptionalHeaderFields() throws Exception {
-               Configuration testSubject;
-               List<List<String>> optionalHeaderFields = null;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setOptionalHeaderFields(optionalHeaderFields);
-       }
-
-       
-       @Test
-       public void testGetForwardHeaderFields() throws Exception {
-               Configuration testSubject;
-               List<String> result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getForwardHeaderFields();
-       }
-
-       
-       @Test
-       public void testSetForwardHeaderFields() throws Exception {
-               Configuration testSubject;
-               List<String> forwardHeaderFields = null;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setForwardHeaderFields(forwardHeaderFields);
-       }
-
-       
-       @Test
-       public void testGetFeFqdn() throws Exception {
-               Configuration testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getFeFqdn();
-       }
-
-       
-       @Test
-       public void testSetFeFqdn() throws Exception {
-               Configuration testSubject;
-               String feFqdn = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setFeFqdn(feFqdn);
-       }
-
-
-       @Test
-       public void testToString() throws Exception {
-               Configuration testSubject;
-               String result;
+               assertEquals(configuration.getHealthCheckIntervalInSeconds(defaultTestTimeout).intValue(),defaultTestTimeout);
 
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.toString();
+               configuration.setHealthCheckIntervalInSeconds(setTestTimeout);
+               assertEquals(configuration.getHealthCheckIntervalInSeconds(defaultTestTimeout).intValue(),setTestTimeout);
        }
 }
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConnectionTest.java b/common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConnectionTest.java
new file mode 100644 (file)
index 0000000..665a79f
--- /dev/null
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.fe.config;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+public class ConnectionTest {
+
+    @Test
+    public void validateBean() {
+        assertThat(Connection.class, allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+
+    @Test
+    public void validateToString() {
+        final String testUrl = "test/url";
+        final int testPoolSize = 7;
+        Connection connection = new Connection();
+        connection.setUrl(testUrl);
+        connection.setPoolSize(testPoolSize);
+
+        assertTrue(connection.toString().contains(testUrl));
+        assertTrue(connection.toString().contains(Integer.toString(testPoolSize)));
+    }
+}
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/fe/config/FeEcompErrorManagerTest.java b/common-app-api/src/test/java/org/openecomp/sdc/fe/config/FeEcompErrorManagerTest.java
new file mode 100644 (file)
index 0000000..7df4a39
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.fe.config;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.junit.Assert.assertEquals;
+
+@RunWith(MockitoJUnitRunner.class)
+public class FeEcompErrorManagerTest {
+    private FeEcompErrorManager feEcompErrorManager;
+
+    @Mock
+    private ConfigurationManager configurationManager;
+
+    @Before
+    public void setUp () {
+        ConfigurationManager.setTestInstance(configurationManager);
+        feEcompErrorManager = FeEcompErrorManager.getInstance();
+    }
+
+    @Test
+    public void validateInstanceGetsProperTestManager() {
+        assertEquals(feEcompErrorManager.getConfigurationManager(),configurationManager);
+    }
+}
diff --git a/common-app-api/src/test/java/org/openecomp/sdc/fe/config/PluginsConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/fe/config/PluginsConfigurationTest.java
new file mode 100644 (file)
index 0000000..0365085
--- /dev/null
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.fe.config;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanToString;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.CoreMatchers.allOf;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class PluginsConfigurationTest {
+
+    @Test
+    public void validateBean() {
+        assertThat(PluginsConfiguration.class, allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters(),
+                hasValidBeanToString()
+        ));
+    }
+
+    @Test
+    public void validatePluginBean() {
+        assertThat(PluginsConfiguration.Plugin.class, allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters()
+        ));
+    }
+
+    @Test
+    public void validatePluginDisplayOptionsBean() {
+        assertThat(PluginsConfiguration.PluginDisplayOptions.class, allOf(
+                hasValidBeanConstructor(),
+                hasValidGettersAndSetters(),
+                hasValidBeanToString()
+        ));
+    }
+}