diff options
author | Tomasz Golabek <tomasz.golabek@nokia.com> | 2019-08-22 11:21:04 +0200 |
---|---|---|
committer | Piotr Darosz <piotr.darosz@nokia.com> | 2019-08-22 11:10:26 +0000 |
commit | 3bdedab365bf7dbc2288c988e24a97ed4823d864 (patch) | |
tree | b728cf08a8bc3aabd3e255811021b6de26539837 | |
parent | e558a6469df40ba7c7aca8cdf81cacd703cd4b0b (diff) |
unit tests - catalog-model
Additional junit tests
Change-Id: I9952933895ba22114fb0bf19a51e54f1a232c8f3
Issue-ID: SDC-2326
Signed-off-by: Tomasz Golabek <tomasz.golabek@nokia.com>
17 files changed, 413 insertions, 314 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Schema.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Schema.java index 978ac5f19d..794b775eee 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Schema.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Schema.java @@ -20,16 +20,10 @@ 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() { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadNodeFilterPropertyInfo.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadNodeFilterPropertyInfo.java index ea94ca23e4..c5f5b2f790 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadNodeFilterPropertyInfo.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadNodeFilterPropertyInfo.java @@ -42,7 +42,7 @@ public class UploadNodeFilterPropertyInfo { return values; } - public void setValue(List<String> values) { + public void setValues(List<String> values) { this.values = values; } } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiCombination.java b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiCombination.java index 29fee14e97..c9a94ce77a 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiCombination.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiCombination.java @@ -18,11 +18,17 @@ 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 index 0000000000..3e9b4ea2e4 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/config/CatalogModelSpringConfigTest.java @@ -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 index 0000000000..86ed903df6 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ConsumerDefinitionTest.java @@ -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 index 0000000000..e0a44b1078 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/SchemaTest.java @@ -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 index 0000000000..363005167e --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadNodeFilterPropertyInfoTest.java @@ -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 diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadPropInfoTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadPropInfoTest.java index bec936a52e..942b80cc7c 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadPropInfoTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadPropInfoTest.java @@ -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. @@ -17,106 +17,16 @@ * 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 diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadReqInfoTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadReqInfoTest.java index 6dc8cd681c..8ce7d8db57 100644 --- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadReqInfoTest.java +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/UploadReqInfoTest.java @@ -17,59 +17,17 @@ * 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 index 0000000000..bcbdbfa0c8 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/normatives/ToscaTypeMetadataTest.java @@ -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 index 0000000000..46f09f754d --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/utils/ComponentUtilitiesTest.java @@ -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 index 0000000000..599d5a2b86 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/utils/GroupUtilsTest.java @@ -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 index 0000000000..e95fc85833 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UIConstraintTest.java @@ -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 index 0000000000..8f767fe418 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UINodeFilterTest.java @@ -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 index 0000000000..3bce3fd779 --- /dev/null +++ b/catalog-model/src/test/java/org/openecomp/sdc/be/ui/model/UiCombinationTest.java @@ -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 diff --git a/common-be/pom.xml b/common-be/pom.xml index baefbc9f9f..b8365ff990 100644 --- a/common-be/pom.xml +++ b/common-be/pom.xml @@ -76,6 +76,12 @@ <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> diff --git a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinitionTest.java b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinitionTest.java index 4780c4753f..ddcb32f87a 100644 --- a/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinitionTest.java +++ b/common-be/src/test/java/org/openecomp/sdc/be/datatypes/elements/ConsumerDataDefinitionTest.java @@ -17,13 +17,15 @@ * 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 { |