unit tests - catalog-model 87/94087/2
authorTomasz Golabek <tomasz.golabek@nokia.com>
Thu, 22 Aug 2019 09:21:04 +0000 (11:21 +0200)
committerPiotr Darosz <piotr.darosz@nokia.com>
Thu, 22 Aug 2019 11:10:26 +0000 (11:10 +0000)
Additional junit tests

Change-Id: I9952933895ba22114fb0bf19a51e54f1a232c8f3
Issue-ID: SDC-2326
Signed-off-by: Tomasz Golabek <tomasz.golabek@nokia.com>
17 files changed:
catalog-model/src/main/java/org/openecomp/sdc/be/model/Schema.java
catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadNodeFilterPropertyInfo.java
catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiCombination.java
catalog-model/src/test/java/org/openecomp/sdc/be/config/CatalogModelSpringConfigTest.java [new file with mode: 0644]
catalog-model/src/test/java/org/openecomp/sdc/be/model/ConsumerDefinitionTest.java [new file with mode: 0644]
catalog-model/src/test/java/org/openecomp/sdc/be/model/SchemaTest.java [new file with mode: 0644]
catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadNodeFilterPropertyInfoTest.java [new file with mode: 0644]
catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadPropInfoTest.java
catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadReqInfoTest.java
catalog-model/src/test/java/org/openecomp/sdc/be/model/normatives/ToscaTypeMetadataTest.java [new file with mode: 0644]
catalog-model/src/test/java/org/openecomp/sdc/be/model/utils/ComponentUtilitiesTest.java [new file with mode: 0644]
catalog-model/src/test/java/org/openecomp/sdc/be/model/utils/GroupUtilsTest.java [new file with mode: 0644]
catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UIConstraintTest.java [new file with mode: 0644]
catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UINodeFilterTest.java [new file with mode: 0644]
catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiCombinationTest.java [new file with mode: 0644]
common-be/pom.xml
common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinitionTest.java

index 978ac5f..794b775 100644 (file)
 
 package org.openecomp.sdc.be.model;
 
-import java.util.List;
-import java.util.Map;
-
 /**
  * Schema allows to create new types that can be used along TOSCA definitions.
  */
 public class Schema {
-    private String derivedFrom;
-    private List<PropertyConstraint> constraints;
-    private Map<String, PropertyDefinition> properties;
     private PropertyDefinition property;
 
     public PropertyDefinition getProperty() {
index ea94ca2..c5f5b2f 100644 (file)
@@ -42,7 +42,7 @@ public class UploadNodeFilterPropertyInfo {
         return values;
     }
 
-    public void setValue(List<String> values) {
+    public void setValues(List<String> values) {
         this.values = values;
     }
 }
index 29fee14..c9a94ce 100644 (file)
 
 package org.openecomp.sdc.be.ui.model;
 
+import com.google.common.annotations.VisibleForTesting;
+
 public class UiCombination {
 
     String name;
     String description;
 
+    @VisibleForTesting
+    UiCombination() {
+    }
+
     public UiCombination(String name, String description) {
         this.name = name;
         this.description = description;
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/config/CatalogModelSpringConfigTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/config/CatalogModelSpringConfigTest.java
new file mode 100644 (file)
index 0000000..3e9b4ea
--- /dev/null
@@ -0,0 +1,35 @@
+/*-
+ * ============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.be.config;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.model.tosca.validators.DataTypeValidatorConverter;
+
+public class CatalogModelSpringConfigTest {
+
+    @Test
+    public void shouldReturnDataTypeValidatorConverter() {
+        DataTypeValidatorConverter dataTypeValidatorConverter = new CatalogModelSpringConfig()
+            .dataTypeValidatorConverter();
+        assertNotNull(dataTypeValidatorConverter);
+    }
+}
\ No newline at end of file
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ConsumerDefinitionTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ConsumerDefinitionTest.java
new file mode 100644 (file)
index 0000000..86ed903
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. 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.be.model;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+import org.openecomp.sdc.be.datatypes.elements.ConsumerDataDefinition;
+
+public class ConsumerDefinitionTest {
+    @Test
+    public void shouldHaveValidGettersAndSetters() {
+        assertThat(ConsumerDataDefinition.class,
+            hasValidGettersAndSettersExcluding("empty", "ownerIdIfEmpty", "type", "version"));
+    }
+}
\ No newline at end of file
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/SchemaTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/SchemaTest.java
new file mode 100644 (file)
index 0000000..e0a44b1
--- /dev/null
@@ -0,0 +1,32 @@
+/*-
+ * ============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.be.model;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.junit.Test;
+
+public class SchemaTest {
+    @Test
+    public void shouldHaveValidGettersAndSetters() {
+        assertThat(Schema.class, hasValidGettersAndSetters());
+    }
+}
\ No newline at end of file
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadNodeFilterPropertyInfoTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadNodeFilterPropertyInfoTest.java
new file mode 100644 (file)
index 0000000..3630051
--- /dev/null
@@ -0,0 +1,32 @@
+/*-
+ * ============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.be.model;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.junit.Test;
+
+public class UploadNodeFilterPropertyInfoTest {
+    @Test
+    public void shouldHaveValidGettersAndSetters() {
+        assertThat(UploadNodeFilterPropertyInfo.class, hasValidGettersAndSetters());
+    }
+}
\ No newline at end of file
index bec936a..942b80c 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.openecomp.sdc.be.model;
 
-import java.util.List;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
 
 import org.junit.Test;
-import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition;
-
 
 public class UploadPropInfoTest {
-
-       private UploadPropInfo createTestSubject() {
-               return new UploadPropInfo();
-       }
-
-       
-       @Test
-       public void testGetGet_input() throws Exception {
-               UploadPropInfo testSubject;
-               List<GetInputValueDataDefinition> result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getGet_input();
-       }
-
-       
-       @Test
-       public void testSetGet_input() throws Exception {
-               UploadPropInfo testSubject;
-               List<GetInputValueDataDefinition> get_input = null;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setGet_input(get_input);
-       }
-
-       
-       @Test
-       public void testGetValue() throws Exception {
-               UploadPropInfo testSubject;
-               Object result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getValue();
-       }
-
-       
        @Test
-       public void testSetValue() throws Exception {
-               UploadPropInfo testSubject;
-               Object value = null;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setValue(value);
-       }
-
-       
-       @Test
-       public void testGetDescription() throws Exception {
-               UploadPropInfo testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getDescription();
-       }
-
-       
-       @Test
-       public void testSetDescription() throws Exception {
-               UploadPropInfo testSubject;
-               String description = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setDescription(description);
-       }
-
-       
-       @Test
-       public void testIsPassword() throws Exception {
-               UploadPropInfo testSubject;
-               boolean result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.isPassword();
-       }
-
-       
-       @Test
-       public void testSetPassword() throws Exception {
-               UploadPropInfo testSubject;
-               boolean password = false;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setPassword(password);
+       public void shouldHaveValidGettersAndSetters() {
+               assertThat(UploadPropInfo.class, hasValidGettersAndSetters());
        }
-}
+}
\ No newline at end of file
index 6dc8cd6..8ce7d8d 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.openecomp.sdc.be.model;
 
-import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
 
+import org.junit.Test;
 
 public class UploadReqInfoTest {
 
-       private UploadReqInfo createTestSubject() {
-               return new UploadReqInfo();
-       }
-
-       
-       @Test
-       public void testGetCapabilityName() throws Exception {
-               UploadReqInfo testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getCapabilityName();
-       }
-
-       
        @Test
-       public void testSetCapabilityName() throws Exception {
-               UploadReqInfo testSubject;
-               String capabilityName = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setCapabilityName(capabilityName);
-       }
-
-       
-       @Test
-       public void testGetNode() throws Exception {
-               UploadReqInfo testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getNode();
-       }
-
-       
-       @Test
-       public void testSetNode() throws Exception {
-               UploadReqInfo testSubject;
-               String node = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setNode(node);
+       public void shouldHaveValidGettersAndSetters() {
+               assertThat(UploadReqInfo.class, hasValidGettersAndSetters());
        }
 }
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/normatives/ToscaTypeMetadataTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/normatives/ToscaTypeMetadataTest.java
new file mode 100644 (file)
index 0000000..bcbdbfa
--- /dev/null
@@ -0,0 +1,32 @@
+/*-
+ * ============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.be.model.normatives;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+public class ToscaTypeMetadataTest {
+    @Test
+    public void shouldHaveValidGettersAndSetters() {
+        assertThat(ToscaTypeMetadata.class, hasValidGettersAndSetters());
+    }
+}
\ No newline at end of file
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/utils/ComponentUtilitiesTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/utils/ComponentUtilitiesTest.java
new file mode 100644 (file)
index 0000000..46f09f7
--- /dev/null
@@ -0,0 +1,79 @@
+/*-
+ * ============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.be.model.utils;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import org.junit.Before;
+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.be.datatypes.elements.Annotation;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.InputDefinition;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ComponentUtilitiesTest {
+
+    @Mock
+    private Component component;
+    @Mock
+    private ComponentInstance componentInstance;
+    private Optional<ComponentInstance> optionalComponentInstance;
+
+    @Before
+    public void setUp() throws Exception {
+        optionalComponentInstance = Optional.of(componentInstance);
+    }
+
+    @Test
+    public void shouldGetComponentInstanceNameByInstanceId() {
+        Mockito.when(component.getComponentInstanceById("1")).thenReturn(optionalComponentInstance);
+        Mockito.when(component.getComponentInstanceByName("1")).thenReturn(optionalComponentInstance);
+        Mockito.when(componentInstance.getName()).thenReturn("1");
+        Optional<String> componentInstanceNameByInstanceId = ComponentUtilities
+            .getComponentInstanceNameByInstanceId(component, "1");
+        assertEquals(componentInstanceNameByInstanceId.orElse(null), "1");
+    }
+
+    @Test
+    public void shouldGetInputByName() {
+        List<InputDefinition> inputs = new ArrayList<>();
+        PropertyDataDefinition prop = new PropertyDataDefinition();
+        prop.setName("test");
+        InputDefinition input = new InputDefinition(prop);
+        List<Annotation> annotations = new ArrayList<>();
+        Annotation annotation = new Annotation();
+        annotation.setName("annotation");
+        annotations.add(annotation);
+        input.setAnnotationsToInput(annotations);
+        inputs.add(input);
+        Mockito.when(component.safeGetInputs()).thenReturn(inputs);
+        List<Annotation> result = ComponentUtilities.getInputAnnotations(component, "test");
+        assertEquals(result.get(0), annotation);
+    }
+}
\ No newline at end of file
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/utils/GroupUtilsTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/utils/GroupUtilsTest.java
new file mode 100644 (file)
index 0000000..599d5a2
--- /dev/null
@@ -0,0 +1,41 @@
+/*-
+ * ============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.be.model.utils;
+
+import static org.junit.Assert.*;
+import static org.openecomp.sdc.common.api.Constants.DEFAULT_GROUP_VF_MODULE;
+import static org.openecomp.sdc.common.api.Constants.GROUP_TOSCA_HEAT;
+
+import org.junit.Test;
+
+public class GroupUtilsTest {
+
+    @Test
+    public void shouldBeVfModule() {
+        boolean vfModule = GroupUtils.isVfModule(DEFAULT_GROUP_VF_MODULE);
+        assertTrue(vfModule);
+    }
+
+    @Test
+    public void shouldNotBeVfModule() {
+        boolean vfModule = GroupUtils.isVfModule(GROUP_TOSCA_HEAT);
+        assertFalse(vfModule);
+    }
+}
\ No newline at end of file
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UIConstraintTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UIConstraintTest.java
new file mode 100644 (file)
index 0000000..e95fc85
--- /dev/null
@@ -0,0 +1,32 @@
+/*-
+ * ============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.be.ui.model;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.junit.Test;
+
+public class UIConstraintTest {
+    @Test
+    public void shouldHaveValidGettersAndSetters() {
+        assertThat(UIConstraint.class, hasValidGettersAndSetters());
+    }
+}
\ No newline at end of file
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UINodeFilterTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UINodeFilterTest.java
new file mode 100644 (file)
index 0000000..8f767fe
--- /dev/null
@@ -0,0 +1,32 @@
+/*-
+ * ============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.be.ui.model;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.junit.Test;
+
+public class UINodeFilterTest {
+    @Test
+    public void shouldHaveValidGettersAndSetters() {
+        assertThat(UINodeFilter.class, hasValidGettersAndSetters());
+    }
+}
\ No newline at end of file
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiCombinationTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiCombinationTest.java
new file mode 100644 (file)
index 0000000..3bce3fd
--- /dev/null
@@ -0,0 +1,32 @@
+/*-
+ * ============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.be.ui.model;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.junit.Test;
+
+public class UiCombinationTest {
+    @Test
+    public void shouldHaveValidGettersAndSetters() {
+        assertThat(UiCombination.class, hasValidGettersAndSetters());
+    }
+}
\ No newline at end of file
index baefbc9..b8365ff 100644 (file)
       <artifactId>lombok</artifactId>
       <version>${lombok.version}</version>
     </dependency>
+    <dependency>
+      <groupId>com.google.code.bean-matchers</groupId>
+      <artifactId>bean-matchers</artifactId>
+      <version>${bean-matchers.version}</version>
+      <scope>test</scope>
+    </dependency>
 
   </dependencies>
   <build>
index 4780c47..ddcb32f 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.openecomp.sdc.be.datatypes.elements;
 
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding;
+import static org.junit.Assert.assertThat;
+
 import org.junit.Assert;
 import org.junit.Test;
 
-
 public class ConsumerDataDefinitionTest {
 
        private ConsumerDataDefinition createTestSubject() {
@@ -31,168 +33,10 @@ public class ConsumerDataDefinitionTest {
        }
 
        @Test
-       public void testCopyConstructor() throws Exception {
-               ConsumerDataDefinition testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               new ConsumerDataDefinition(testSubject);
-       }
-       
-       @Test
-       public void testGetConsumerName() throws Exception {
-               ConsumerDataDefinition testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getConsumerName();
-       }
-
-       
-       @Test
-       public void testSetConsumerName() throws Exception {
-               ConsumerDataDefinition testSubject;
-               String consumerName = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setConsumerName(consumerName);
-       }
-
-       
-       @Test
-       public void testGetConsumerPassword() throws Exception {
-               ConsumerDataDefinition testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getConsumerPassword();
-       }
-
-       
-       @Test
-       public void testSetConsumerPassword() throws Exception {
-               ConsumerDataDefinition testSubject;
-               String consumerPassword = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setConsumerPassword(consumerPassword);
-       }
-
-       
-       @Test
-       public void testGetConsumerSalt() throws Exception {
-               ConsumerDataDefinition testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getConsumerSalt();
-       }
-
-       
-       @Test
-       public void testSetConsumerSalt() throws Exception {
-               ConsumerDataDefinition testSubject;
-               String consumerSalt = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setConsumerSalt(consumerSalt);
-       }
-
-       
-       @Test
-       public void testGetConsumerLastAuthenticationTime() throws Exception {
-               ConsumerDataDefinition testSubject;
-               Long result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getConsumerLastAuthenticationTime();
-       }
-
-       
-       @Test
-       public void testSetConsumerLastAuthenticationTime() throws Exception {
-               ConsumerDataDefinition testSubject;
-               Long consumerLastAuthenticationTime = null;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setConsumerLastAuthenticationTime(consumerLastAuthenticationTime);
-       }
-
-       
-       @Test
-       public void testGetConsumerDetailsLastupdatedtime() throws Exception {
-               ConsumerDataDefinition testSubject;
-               Long result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getConsumerDetailsLastupdatedtime();
-       }
-
-       
-       @Test
-       public void testSetConsumerDetailsLastupdatedtime() throws Exception {
-               ConsumerDataDefinition testSubject;
-               Long consumerDetailsLastupdatedtime = null;
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setConsumerDetailsLastupdatedtime(consumerDetailsLastupdatedtime);
-       }
-
-       
-       @Test
-       public void testGetLastModfierAtuid() throws Exception {
-               ConsumerDataDefinition testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.getLastModfierAtuid();
-       }
-
-       
-       @Test
-       public void testSetLastModfierAtuid() throws Exception {
-               ConsumerDataDefinition testSubject;
-               String lastModfierAtuid = "";
-
-               // default test
-               testSubject = createTestSubject();
-               testSubject.setLastModfierAtuid(lastModfierAtuid);
-       }
-
-       
-       @Test
-       public void testToString() throws Exception {
-               ConsumerDataDefinition testSubject;
-               String result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.toString();
+       public void shouldHaveValidGettersAndSetters() {
+               assertThat(ConsumerDataDefinition.class,
+                       hasValidGettersAndSettersExcluding("empty", "ownerIdIfEmpty", "type", "version"));
        }
-
-       
-       @Test
-       public void testHashCode() throws Exception {
-               ConsumerDataDefinition testSubject;
-               int result;
-
-               // default test
-               testSubject = createTestSubject();
-               result = testSubject.hashCode();
-       }
-
        
        @Test
        public void testEquals() throws Exception {