Getter/setter tests inside the aai model
Refactor of a tests of aai model for getters/setters using google matchers
Issue-ID: VID-228
Change-Id: I5e7912bbcc4bd605002278b50b63d976a2dc55cc
Signed-off-by: tgolabek <tomasz.golabek@nokia.com>
diff --git a/vid-app-common/pom.xml b/vid-app-common/pom.xml
index 7a48522..a42a2b3 100755
--- a/vid-app-common/pom.xml
+++ b/vid-app-common/pom.xml
@@ -347,6 +347,12 @@
<version>4.12</version>
</dependency>
<dependency>
+ <groupId>com.google.code.bean-matchers</groupId>
+ <artifactId>bean-matchers</artifactId>
+ <version>0.11</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160212</version>
diff --git a/vid-app-common/src/test/java/org/onap/src/main/java/org/vid/dao/FnAppDoaImplTest.java b/vid-app-common/src/test/java/org/onap/src/main/java/org/vid/dao/FnAppDoaImplTest.java
deleted file mode 100644
index e98e7b2..0000000
--- a/vid-app-common/src/test/java/org/onap/src/main/java/org/vid/dao/FnAppDoaImplTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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.onap.src.main.java.org.vid.dao;
-
-import java.io.IOException;
-import java.sql.SQLException;
-
-import org.junit.Test;
-
-import org.onap.vid.dao.FnAppDoaImpl;
-
-public class FnAppDoaImplTest {
-
- //@Test
- public void testGetconnection() throws ClassNotFoundException, IOException, SQLException{
- FnAppDoaImpl impl=new FnAppDoaImpl();
- impl.getConnection(null,null,null, null);
-
- }
-
- //@Test
- public void testProfileCount() throws ClassNotFoundException, IOException, SQLException{
- FnAppDoaImpl impl=new FnAppDoaImpl();
- impl.getProfileCount(null,null,null, null);
- }
-
-}
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentListTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentListTest.java
index 87d2bd8..28b939e 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentListTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentListTest.java
@@ -1,33 +1,14 @@
package org.onap.vid.aai.model.AaiGetOperationalEnvironments;
-import java.util.List;
-
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Test;
-import org.onap.vid.aai.OperationalEnvironment;
public class OperationalEnvironmentListTest {
- private OperationalEnvironmentList createTestSubject() {
- return new OperationalEnvironmentList();
- }
-
@Test
- public void testGetOperationalEnvironment() throws Exception {
- OperationalEnvironmentList testSubject;
- List<OperationalEnvironment> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getOperationalEnvironment();
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(OperationalEnvironmentList.class, hasValidGettersAndSetters());
}
- @Test
- public void testSetOperationalEnvironment() throws Exception {
- OperationalEnvironmentList testSubject;
- List<OperationalEnvironment> operationalEnvironment = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setOperationalEnvironment(operationalEnvironment);
- }
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetPnfResponseTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetPnfResponseTest.java
index bf248a3..7b5b8aa 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetPnfResponseTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetPnfResponseTest.java
@@ -1,43 +1,41 @@
package org.onap.vid.aai.model;
-import java.util.Map;
+import java.io.IOException;
+import java.util.ArrayList;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.junit.Before;
import org.junit.Test;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.StringContains.containsString;
+import static org.hamcrest.core.IsEqual.equalTo;
+
public class AaiGetPnfResponseTest {
- private AaiGetPnfResponse createTestSubject() {
- return new AaiGetPnfResponse();
+ private AaiGetPnfResponse aaiGetPnfResponse;
+
+ @Before
+ public void setUp(){
+ aaiGetPnfResponse = new AaiGetPnfResponse();
+ aaiGetPnfResponse.results = new ArrayList<>();
+ aaiGetPnfResponse.setAdditionalProperty("key1", "value1");
+ aaiGetPnfResponse.setAdditionalProperty("key2", "value2");
}
@Test
- public void testGetAdditionalProperties() throws Exception {
- AaiGetPnfResponse testSubject;
- Map<String, Object> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getAdditionalProperties();
+ public void shouldHaveValidGettersAndSetters() throws IOException {
+ String result = new ObjectMapper().writeValueAsString(aaiGetPnfResponse);
+ assertThat(result, containsString("key1"));
+ assertThat(result, containsString("value2"));
+ assertThat(result, containsString("key2"));
+ assertThat(result, containsString("value2"));
}
@Test
- public void testSetAdditionalProperty() throws Exception {
- AaiGetPnfResponse testSubject;
- String name = "";
- Object value = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setAdditionalProperty(name, value);
+ public void shouldHaveValidToString(){
+ assertThat(aaiGetPnfResponse.toString(),
+ equalTo("AaiGetPnfResponse{results=[], additionalProperties={key1=value1, key2=value2}}"));
}
- @Test
- public void testToString() throws Exception {
- AaiGetPnfResponse testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.toString();
- }
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetPnfs/PnfTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetPnfs/PnfTest.java
index 22aad6e..6f5a912 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetPnfs/PnfTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiGetPnfs/PnfTest.java
@@ -2,149 +2,14 @@
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
public class PnfTest {
- private Pnf createTestSubject() {
- return new Pnf();
- }
-
@Test
- public void testGetPnfName() throws Exception {
- Pnf testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getPnfName();
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(Pnf.class, hasValidGettersAndSetters());
}
- @Test
- public void testSetPnfName() throws Exception {
- Pnf testSubject;
- String pnfName = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setPnfName(pnfName);
- }
-
- @Test
- public void testGetEquipType() throws Exception {
- Pnf testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getEquipType();
- }
-
- @Test
- public void testSetEquipType() throws Exception {
- Pnf testSubject;
- String equipType = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setEquipType(equipType);
- }
-
- @Test
- public void testGetEquipVendor() throws Exception {
- Pnf testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getEquipVendor();
- }
-
- @Test
- public void testSetEquipVendor() throws Exception {
- Pnf testSubject;
- String equipVendor = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setEquipVendor(equipVendor);
- }
-
- @Test
- public void testGetPnfName2() throws Exception {
- Pnf testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getPnfName2();
- }
-
- @Test
- public void testSetPnfName2() throws Exception {
- Pnf testSubject;
- String pnfName2 = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setPnfName2(pnfName2);
- }
-
- @Test
- public void testGetPnfId() throws Exception {
- Pnf testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getPnfId();
- }
-
- @Test
- public void testSetPnfId() throws Exception {
- Pnf testSubject;
- String pnfId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setPnfId(pnfId);
- }
-
- @Test
- public void testGetEquipModel() throws Exception {
- Pnf testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getEquipModel();
- }
-
- @Test
- public void testSetEquipModel() throws Exception {
- Pnf testSubject;
- String equipModel = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setEquipModel(equipModel);
- }
-
- @Test
- public void testGetPnfName2Source() throws Exception {
- Pnf testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getPnfName2Source();
- }
-
- @Test
- public void testSetPnfName2Source() throws Exception {
- Pnf testSubject;
- String pnfName2Source = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setPnfName2Source(pnfName2Source);
- }
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiRelationResponseTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiRelationResponseTest.java
index d9f3fe5..3eaa75d 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiRelationResponseTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/AaiRelationResponseTest.java
@@ -2,49 +2,14 @@
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
public class AaiRelationResponseTest {
- private AaiRelationResponse createTestSubject() {
- return new AaiRelationResponse();
- }
-
@Test
- public void testGetResourceVersion() throws Exception {
- AaiRelationResponse testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getResourceVersion();
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(AaiRelationResponse.class, hasValidGettersAndSetters());
}
- @Test
- public void testSetResourceVersion() throws Exception {
- AaiRelationResponse testSubject;
- String resourceVersion = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setResourceVersion(resourceVersion);
- }
-
- @Test
- public void testGetRelationshipList() throws Exception {
- AaiRelationResponse testSubject;
- RelationshipList result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getRelationshipList();
- }
-
- @Test
- public void testSetRelationshipList() throws Exception {
- AaiRelationResponse testSubject;
- RelationshipList relationshipList = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setRelationshipList(relationshipList);
- }
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/GetServiceModelsByDistributionStatusResponseTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/GetServiceModelsByDistributionStatusResponseTest.java
index 748a181..437f139 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/GetServiceModelsByDistributionStatusResponseTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/GetServiceModelsByDistributionStatusResponseTest.java
@@ -1,32 +1,15 @@
package org.onap.vid.aai.model;
-import java.util.List;
-
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
public class GetServiceModelsByDistributionStatusResponseTest {
- private GetServiceModelsByDistributionStatusResponse createTestSubject() {
- return new GetServiceModelsByDistributionStatusResponse();
- }
-
@Test
- public void testGetResults() throws Exception {
- GetServiceModelsByDistributionStatusResponse testSubject;
- List<Result> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getResults();
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(GetServiceModelsByDistributionStatusResponse.class, hasValidGettersAndSetters());
}
- @Test
- public void testSetResults() throws Exception {
- GetServiceModelsByDistributionStatusResponse testSubject;
- List<Result> results = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setResults(results);
- }
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/LogicalLinkResponseTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/LogicalLinkResponseTest.java
index 99ee595..a2eb474 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/LogicalLinkResponseTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/LogicalLinkResponseTest.java
@@ -2,6 +2,9 @@
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
public class LogicalLinkResponseTest {
private LogicalLinkResponse createTestSubject() {
@@ -9,122 +12,8 @@
}
@Test
- public void testGetLinkName() throws Exception {
- LogicalLinkResponse testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getLinkName();
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(LogicalLinkResponse.class, hasValidGettersAndSetters());
}
- @Test
- public void testSetLinkName() throws Exception {
- LogicalLinkResponse testSubject;
- String linkName = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setLinkName(linkName);
- }
-
- @Test
- public void testGetInMaint() throws Exception {
- LogicalLinkResponse testSubject;
- Boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getInMaint();
- }
-
- @Test
- public void testSetInMaint() throws Exception {
- LogicalLinkResponse testSubject;
- Boolean inMaint = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setInMaint(inMaint);
- }
-
- @Test
- public void testGetLinkType() throws Exception {
- LogicalLinkResponse testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getLinkType();
- }
-
- @Test
- public void testSetLinkType() throws Exception {
- LogicalLinkResponse testSubject;
- String linkType = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setLinkType(linkType);
- }
-
- @Test
- public void testGetResourceVersion() throws Exception {
- LogicalLinkResponse testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getResourceVersion();
- }
-
- @Test
- public void testSetResourceVersion() throws Exception {
- LogicalLinkResponse testSubject;
- String resourceVersion = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setResourceVersion(resourceVersion);
- }
-
- @Test
- public void testGetPurpose() throws Exception {
- LogicalLinkResponse testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getPurpose();
- }
-
- @Test
- public void testSetPurpose() throws Exception {
- LogicalLinkResponse testSubject;
- String purpose = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setPurpose(purpose);
- }
-
- @Test
- public void testGetRelationshipList() throws Exception {
- LogicalLinkResponse testSubject;
- RelationshipList result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getRelationshipList();
- }
-
- @Test
- public void testSetRelationshipList() throws Exception {
- LogicalLinkResponse testSubject;
- RelationshipList relationshipList = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setRelationshipList(relationshipList);
- }
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/ModelTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/ModelTest.java
index 413c0b3..5b8d439 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/ModelTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/ModelTest.java
@@ -2,89 +2,14 @@
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
public class ModelTest {
- private Model createTestSubject() {
- return new Model();
- }
-
@Test
- public void testGetModelInvariantId() throws Exception {
- Model testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getModelInvariantId();
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(Model.class, hasValidGettersAndSetters());
}
- @Test
- public void testSetModelInvariantId() throws Exception {
- Model testSubject;
- String modelInvariantId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setModelInvariantId(modelInvariantId);
- }
-
- @Test
- public void testGetModelType() throws Exception {
- Model testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getModelType();
- }
-
- @Test
- public void testSetModelType() throws Exception {
- Model testSubject;
- String modelType = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setModelType(modelType);
- }
-
- @Test
- public void testGetResourceVersion() throws Exception {
- Model testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getResourceVersion();
- }
-
- @Test
- public void testSetResourceVersion() throws Exception {
- Model testSubject;
- String resourceVersion = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setResourceVersion(resourceVersion);
- }
-
- @Test
- public void testGetModelVers() throws Exception {
- Model testSubject;
- ModelVers result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getModelVers();
- }
-
- @Test
- public void testSetModelVers() throws Exception {
- Model testSubject;
- ModelVers modelVers = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setModelVers(modelVers);
- }
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/ModelVerTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/ModelVerTest.java
index 99a7a7a..46098ef 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/ModelVerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/ModelVerTest.java
@@ -2,129 +2,13 @@
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
public class ModelVerTest {
- private ModelVer createTestSubject() {
- return new ModelVer();
- }
-
@Test
- public void testGetModelVersionId() throws Exception {
- ModelVer testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getModelVersionId();
- }
-
- @Test
- public void testSetModelVersionId() throws Exception {
- ModelVer testSubject;
- String modelVersionId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setModelVersionId(modelVersionId);
- }
-
- @Test
- public void testGetModelName() throws Exception {
- ModelVer testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getModelName();
- }
-
- @Test
- public void testSetModelName() throws Exception {
- ModelVer testSubject;
- String modelName = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setModelName(modelName);
- }
-
- @Test
- public void testGetModelVersion() throws Exception {
- ModelVer testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getModelVersion();
- }
-
- @Test
- public void testSetModelVersion() throws Exception {
- ModelVer testSubject;
- String modelVersion = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setModelVersion(modelVersion);
- }
-
- @Test
- public void testGetDistributionStatus() throws Exception {
- ModelVer testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getDistributionStatus();
- }
-
- @Test
- public void testSetDistributionStatus() throws Exception {
- ModelVer testSubject;
- String distributionStatus = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setDistributionStatus(distributionStatus);
- }
-
- @Test
- public void testGetResourceVersion() throws Exception {
- ModelVer testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getResourceVersion();
- }
-
- @Test
- public void testSetResourceVersion() throws Exception {
- ModelVer testSubject;
- String resourceVersion = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setResourceVersion(resourceVersion);
- }
-
- @Test
- public void testGetModelDescription() throws Exception {
- ModelVer testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getModelDescription();
- }
-
- @Test
- public void testSetModelDescription() throws Exception {
- ModelVer testSubject;
- String modelDescription = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setModelDescription(modelDescription);
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(ModelVer.class, hasValidGettersAndSetters());
}
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/ModelVersTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/ModelVersTest.java
index 83bda0e..bea3b82 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/ModelVersTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/ModelVersTest.java
@@ -1,32 +1,14 @@
package org.onap.vid.aai.model;
-import java.util.List;
-
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
public class ModelVersTest {
- private ModelVers createTestSubject() {
- return new ModelVers();
- }
-
@Test
- public void testGetModelVer() throws Exception {
- ModelVers testSubject;
- List<ModelVer> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getModelVer();
- }
-
- @Test
- public void testSetModelVer() throws Exception {
- ModelVers testSubject;
- List<ModelVer> modelVer = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setModelVer(modelVer);
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(ModelVers.class, hasValidGettersAndSetters());
}
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/OwningEntityTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/OwningEntityTest.java
index 1e160d2..9cb6a2f 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/OwningEntityTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/OwningEntityTest.java
@@ -2,49 +2,13 @@
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
public class OwningEntityTest {
- private OwningEntity createTestSubject() {
- return new OwningEntity();
- }
-
@Test
- public void testGetOwningEntityId() throws Exception {
- OwningEntity testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getOwningEntityId();
- }
-
- @Test
- public void testSetOwningEntityId() throws Exception {
- OwningEntity testSubject;
- String owningEntityId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setOwningEntityId(owningEntityId);
- }
-
- @Test
- public void testGetOwningEntityName() throws Exception {
- OwningEntity testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getOwningEntityName();
- }
-
- @Test
- public void testSetOwningEntityName() throws Exception {
- OwningEntity testSubject;
- String owningEntityName = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setOwningEntityName(owningEntityName);
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(OwningEntity.class, hasValidGettersAndSetters());
}
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/PnfPropertiesTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/PnfPropertiesTest.java
index 46709af..e2a62c0 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/PnfPropertiesTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/PnfPropertiesTest.java
@@ -1,33 +1,33 @@
package org.onap.vid.aai.model;
-import java.util.Map;
-
+import org.codehaus.jackson.map.ObjectMapper;
+import org.junit.Before;
import org.junit.Test;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.StringContains.containsString;
+
public class PnfPropertiesTest {
- private PnfProperties createTestSubject() {
- return new PnfProperties();
+ private PnfProperties pnfProperties;
+
+ @Before
+ public void setUp(){
+ pnfProperties = new PnfProperties();
+ pnfProperties.setAdditionalProperty("key1", "value1");
+ pnfProperties.setAdditionalProperty("key2", "value2");
}
@Test
- public void testGetAdditionalProperties() throws Exception {
- PnfProperties testSubject;
- Map<String, Object> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getAdditionalProperties();
- }
-
- @Test
- public void testSetAdditionalProperty() throws Exception {
- PnfProperties testSubject;
- String name = "";
- Object value = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setAdditionalProperty(name, value);
+ public void shouldHaveValidGettersAndSetters() throws IOException {
+ String result = new ObjectMapper().writeValueAsString(pnfProperties);
+ assertThat(result, containsString("key1"));
+ assertThat(result, containsString("value2"));
+ assertThat(result, containsString("key2"));
+ assertThat(result, containsString("value2"));
}
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/PnfResultTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/PnfResultTest.java
index 0f66df0..912eea9 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/PnfResultTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/PnfResultTest.java
@@ -1,33 +1,31 @@
package org.onap.vid.aai.model;
-import java.util.Map;
+import java.io.IOException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.junit.Before;
import org.junit.Test;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.StringContains.containsString;
+
public class PnfResultTest {
- private PnfResult createTestSubject() {
- return new PnfResult();
+ private PnfResult pnfResult;
+
+ @Before
+ public void setUp(){
+ pnfResult = new PnfResult();
+ pnfResult.setAdditionalProperty("key1", "value1");
+ pnfResult.setAdditionalProperty("key2", "value2");
}
@Test
- public void testGetAdditionalProperties() throws Exception {
- PnfResult testSubject;
- Map<String, Object> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getAdditionalProperties();
- }
-
- @Test
- public void testSetAdditionalProperty() throws Exception {
- PnfResult testSubject;
- String name = "";
- Object value = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setAdditionalProperty(name, value);
+ public void shouldHaveValidGettersAndSetters() throws IOException {
+ String result = new ObjectMapper().writeValueAsString(pnfResult);
+ assertThat(result, containsString("key1"));
+ assertThat(result, containsString("value2"));
+ assertThat(result, containsString("key2"));
+ assertThat(result, containsString("value2"));
}
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/ProjectResponseTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/ProjectResponseTest.java
index 1784ea5..dc09609 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/ProjectResponseTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/ProjectResponseTest.java
@@ -1,32 +1,14 @@
package org.onap.vid.aai.model;
-import java.util.List;
-
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
public class ProjectResponseTest {
- private ProjectResponse createTestSubject() {
- return new ProjectResponse();
- }
-
@Test
- public void testGetProject() throws Exception {
- ProjectResponse testSubject;
- List<Project> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getProject();
- }
-
- @Test
- public void testSetProject() throws Exception {
- ProjectResponse testSubject;
- List<Project> project = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setProject(project);
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(ProjectResponse.class, hasValidGettersAndSetters());
}
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/ProjectTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/ProjectTest.java
index 8de772d..7d5637f 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/ProjectTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/ProjectTest.java
@@ -2,29 +2,13 @@
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
public class ProjectTest {
- private Project createTestSubject() {
- return new Project();
- }
-
@Test
- public void testGetProjectName() throws Exception {
- Project testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getProjectName();
- }
-
- @Test
- public void testSetProjectName() throws Exception {
- Project testSubject;
- String projectName = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setProjectName(projectName);
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(Project.class, hasValidGettersAndSetters());
}
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/RelatedToPropertyTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/RelatedToPropertyTest.java
index 0d26f56..fd01e13 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/RelatedToPropertyTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/RelatedToPropertyTest.java
@@ -2,54 +2,13 @@
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
public class RelatedToPropertyTest {
- private RelatedToProperty createTestSubject() {
- return new RelatedToProperty();
- }
-
-
@Test
- public void testGetPropertyKey() throws Exception {
- RelatedToProperty testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getPropertyKey();
- }
-
-
- @Test
- public void testSetPropertyKey() throws Exception {
- RelatedToProperty testSubject;
- String propertyKey = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setPropertyKey(propertyKey);
- }
-
-
- @Test
- public void testGetPropertyValue() throws Exception {
- RelatedToProperty testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getPropertyValue();
- }
-
-
- @Test
- public void testSetPropertyValue() throws Exception {
- RelatedToProperty testSubject;
- String propertyValue = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setPropertyValue(propertyValue);
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(RelatedToProperty.class, hasValidGettersAndSetters());
}
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipDataTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipDataTest.java
index ae5f7c3..9e112f1 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipDataTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipDataTest.java
@@ -2,54 +2,14 @@
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
public class RelationshipDataTest {
- private RelationshipData createTestSubject() {
- return new RelationshipData();
- }
-
-
@Test
- public void testGetRelationshipKey() throws Exception {
- RelationshipData testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getRelationshipKey();
- }
-
-
- @Test
- public void testSetRelationshipKey() throws Exception {
- RelationshipData testSubject;
- String relationshipKey = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setRelationshipKey(relationshipKey);
- }
-
-
- @Test
- public void testGetRelationshipValue() throws Exception {
- RelationshipData testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getRelationshipValue();
- }
-
-
- @Test
- public void testSetRelationshipValue() throws Exception {
- RelationshipData testSubject;
- String relationshipValue = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setRelationshipValue(relationshipValue);
+ public void shouldHaveValidGettersAndSetters(){
+ assertThat(RelationshipData.class, hasValidGettersAndSetters());
}
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipTest.java
index 893fc51..7ae9ca5 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/RelationshipTest.java
@@ -1,103 +1,15 @@
package org.onap.vid.aai.model;
-import java.util.List;
-
import org.junit.Test;
-import org.onap.vid.aai.model.Relationship;
-import org.onap.vid.aai.model.RelationshipData;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
public class RelationshipTest {
- private Relationship createTestSubject() {
- return new Relationship();
- }
-
-
- @Test
- public void testGetRelatedTo() throws Exception {
- Relationship testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getRelatedTo();
- }
-
-
- @Test
- public void testSetRelatedTo() throws Exception {
- Relationship testSubject;
- String relatedTo = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setRelatedTo(relatedTo);
- }
-
-
- @Test
- public void testGetRelatedLink() throws Exception {
- Relationship testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getRelatedLink();
- }
-
-
- @Test
- public void testSetRelatedLink() throws Exception {
- Relationship testSubject;
- String relatedLink = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setRelatedLink(relatedLink);
- }
-
-
- @Test
- public void testGetRelationDataList() throws Exception {
- Relationship testSubject;
- List<RelationshipData> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getRelationDataList();
- }
-
-
- @Test
- public void testSetRelationDataList() throws Exception {
- Relationship testSubject;
- List<RelationshipData> relationDataList = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setRelationDataList(relationDataList);
- }
-
-
- @Test
- public void testGetRelatedToPropertyList() throws Exception {
- Relationship testSubject;
- List<RelatedToProperty> result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getRelatedToPropertyList();
- }
-
-
- @Test
- public void testSetRelatedToPropertyList() throws Exception {
- Relationship testSubject;
- List<RelatedToProperty> relatedToPropertyList = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setRelatedToPropertyList(relatedToPropertyList);
- }
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(Relationship.class, hasValidGettersAndSetters());
+ }
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/ResultTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/ResultTest.java
index 91d7763..9f71959 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/ResultTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/ResultTest.java
@@ -2,29 +2,13 @@
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
public class ResultTest {
- private Result createTestSubject() {
- return new Result();
- }
-
@Test
- public void testGetModel() throws Exception {
- Result testSubject;
- Model result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getModel();
- }
-
- @Test
- public void testSetModel() throws Exception {
- Result testSubject;
- Model model = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setModel(model);
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(Result.class, hasValidGettersAndSetters());
}
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/model/ServiceRelationshipsTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/model/ServiceRelationshipsTest.java
index e8bcf5f..9b51ee1 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/model/ServiceRelationshipsTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/model/ServiceRelationshipsTest.java
@@ -2,164 +2,14 @@
import org.junit.Test;
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
public class ServiceRelationshipsTest {
- private ServiceRelationships createTestSubject() {
- return new ServiceRelationships();
- }
-
-
- @Test
- public void testGetServiceInstanceId() throws Exception {
- ServiceRelationships testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getServiceInstanceId();
- }
-
-
- @Test
- public void testSetServiceInstanceId() throws Exception {
- ServiceRelationships testSubject;
- String serviceInstanceId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setServiceInstanceId(serviceInstanceId);
- }
-
-
- @Test
- public void testGetServiceInstanceName() throws Exception {
- ServiceRelationships testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getServiceInstanceName();
- }
-
-
- @Test
- public void testSetServiceInstanceName() throws Exception {
- ServiceRelationships testSubject;
- String serviceInstanceName = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setServiceInstanceName(serviceInstanceName);
- }
-
-
- @Test
- public void testGetModelInvariantId() throws Exception {
- ServiceRelationships testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getModelInvariantId();
- }
-
-
- @Test
- public void testSetModelInvariantId() throws Exception {
- ServiceRelationships testSubject;
- String modelInvariantId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setModelInvariantId(modelInvariantId);
- }
-
-
- @Test
- public void testGetModelVersionId() throws Exception {
- ServiceRelationships testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getModelVersionId();
- }
-
-
- @Test
- public void testSetModelVersionId() throws Exception {
- ServiceRelationships testSubject;
- String modelVersionId = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setModelVersionId(modelVersionId);
- }
-
-
- @Test
- public void testGetResourceVersion() throws Exception {
- ServiceRelationships testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getResourceVersion();
- }
-
-
- @Test
- public void testSetResourceVersion() throws Exception {
- ServiceRelationships testSubject;
- String resourceVersion = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setResourceVersion(resourceVersion);
- }
-
-
- @Test
- public void testGetOrchestrationStatus() throws Exception {
- ServiceRelationships testSubject;
- String result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getOrchestrationStatus();
- }
-
-
- @Test
- public void testSetOrchestrationStatus() throws Exception {
- ServiceRelationships testSubject;
- String orchestrationStatus = "";
-
- // default test
- testSubject = createTestSubject();
- testSubject.setOrchestrationStatus(orchestrationStatus);
- }
-
-
- @Test
- public void testGetRelationshipList() throws Exception {
- ServiceRelationships testSubject;
- RelationshipList result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.getRelationshipList();
- }
-
-
- @Test
- public void testSetRelationshipList() throws Exception {
- ServiceRelationships testSubject;
- RelationshipList relationshipList = null;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setRelationshipList(relationshipList);
- }
+ @Test
+ public void shouldHaveValidGettersAndSetters() {
+ assertThat(ServiceRelationships.class, hasValidGettersAndSetters());
+ }
}
\ No newline at end of file