Refactor tests inside the catalog-dao model

Use Hamcrest matchers to simplify getter/setter tests structure

Change-Id: Icee88395034ffb61e60a9190d2a9e77571e6fac3
Issue-ID: SDC-1434
Signed-off-by: Piotr Darosz <piotr.darosz@nokia.com>
diff --git a/catalog-dao/pom.xml b/catalog-dao/pom.xml
index 7186742..b0ffa4c 100644
--- a/catalog-dao/pom.xml
+++ b/catalog-dao/pom.xml
@@ -120,6 +120,13 @@
 		</dependency>
 
 		<dependency>
+			<groupId>com.google.code.bean-matchers</groupId>
+			<artifactId>bean-matchers</artifactId>
+			<version>${bean-matchers.version}</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
 			<groupId>org.yaml</groupId>
 			<artifactId>snakeyaml</artifactId>
 			<version>${snakeyaml.version}</version>
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/model/FacetedSearchFacet.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/model/FacetedSearchFacet.java
index 24db9b6..c71c8ae 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/model/FacetedSearchFacet.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/model/FacetedSearchFacet.java
@@ -33,6 +33,9 @@
 		this.facetValue = facetValue;
 	}
 
+	private FacetedSearchFacet() {
+	}
+
 	public String getFacetValue() {
 		return facetValue;
 	}
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FacetedSearchFacetTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FacetedSearchFacetTest.java
index 79ee69b..8a02bc0 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FacetedSearchFacetTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FacetedSearchFacetTest.java
@@ -1,55 +1,13 @@
 package org.openecomp.sdc.be.dao.model;
 
 import org.junit.Test;
-
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
 
 public class FacetedSearchFacetTest {
 
-	private FacetedSearchFacet createTestSubject() {
-		return new FacetedSearchFacet("", 0);
-	}
-
-	
 	@Test
-	public void testGetFacetValue() throws Exception {
-		FacetedSearchFacet testSubject;
-		String result;
-
-		// default test
-		testSubject = createTestSubject();
-		result = testSubject.getFacetValue();
-	}
-
-	
-	@Test
-	public void testSetFacetValue() throws Exception {
-		FacetedSearchFacet testSubject;
-		String facetValue = "";
-
-		// default test
-		testSubject = createTestSubject();
-		testSubject.setFacetValue(facetValue);
-	}
-
-	
-	@Test
-	public void testGetCount() throws Exception {
-		FacetedSearchFacet testSubject;
-		long result;
-
-		// default test
-		testSubject = createTestSubject();
-		result = testSubject.getCount();
-	}
-
-	
-	@Test
-	public void testSetCount() throws Exception {
-		FacetedSearchFacet testSubject;
-		long count = 555;
-
-		// default test
-		testSubject = createTestSubject();
-		testSubject.setCount(count);
+	public void shouldHaveValidGettersAndSetters(){
+		assertThat(FacetedSearchFacet.class, hasValidGettersAndSetters());
 	}
 }
\ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FacetedSearchResult.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FacetedSearchResult.java
new file mode 100644
index 0000000..b262dec
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FacetedSearchResult.java
@@ -0,0 +1,13 @@
+package org.openecomp.sdc.be.dao.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class FacetedSearchResult {
+	@Test
+	public void shouldHaveValidGettersAndSetters(){
+		assertThat(FacetedSearchResult.class, hasValidGettersAndSetters());
+	}
+}
\ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FetchContext.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FetchContext.java
new file mode 100644
index 0000000..c7ed9bc
--- /dev/null
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/FetchContext.java
@@ -0,0 +1,13 @@
+package org.openecomp.sdc.be.dao.model;
+
+import org.junit.Test;
+
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class FetchContext {
+	@Test
+	public void shouldHaveValidGettersAndSetters(){
+		assertThat(FetchContext.class, hasValidGettersAndSetters());
+	}
+}
\ No newline at end of file
diff --git a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/GetMultipleDataResultTest.java b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/GetMultipleDataResultTest.java
index a330451..843e398 100644
--- a/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/GetMultipleDataResultTest.java
+++ b/catalog-dao/src/test/java/org/openecomp/sdc/be/dao/model/GetMultipleDataResultTest.java
@@ -1,137 +1,20 @@
 package org.openecomp.sdc.be.dao.model;
 
-import org.apache.tinkerpop.gremlin.structure.T;
 import org.junit.Test;
 
+import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
+import static org.hamcrest.MatcherAssert.assertThat;
+
 public class GetMultipleDataResultTest {
-
-	private GetMultipleDataResult createTestSubject() {
-		return new GetMultipleDataResult<>();
-	}
-
+	
 	@Test
 	public void testCtor() throws Exception {
 		new GetMultipleDataResult<>(new String [1], new Object[1]);
 		new GetMultipleDataResult<>(new String [1], new String [1], 0L, 0L, 1, 1);
 	}
-	
+  
 	@Test
-	public void testGetTypes() throws Exception {
-		GetMultipleDataResult testSubject;
-		String[] result;
-
-		// default test
-		testSubject = createTestSubject();
-		result = testSubject.getTypes();
-	}
-
-	@Test
-	public void testGetData() throws Exception {
-		GetMultipleDataResult testSubject;
-		Object[] result;
-
-		// default test
-		testSubject = createTestSubject();
-		result = testSubject.getData();
-	}
-
-	@Test
-	public void testSetTypes() throws Exception {
-		GetMultipleDataResult testSubject;
-		String[] types = new String[] { "" };
-
-		// default test
-		testSubject = createTestSubject();
-		testSubject.setTypes(types);
-	}
-
-	@Test
-	public void testSetData() throws Exception {
-		GetMultipleDataResult testSubject;
-		T[] data = new T[] { null };
-
-		// default test
-		testSubject = createTestSubject();
-		testSubject.setData(data);
-	}
-
-	@Test
-	public void testSetQueryDuration() throws Exception {
-		GetMultipleDataResult testSubject;
-		long queryDuration = 0L;
-
-		// default test
-		testSubject = createTestSubject();
-		testSubject.setQueryDuration(queryDuration);
-	}
-
-	@Test
-	public void testSetTotalResults() throws Exception {
-		GetMultipleDataResult testSubject;
-		long totalResults = 0L;
-
-		// default test
-		testSubject = createTestSubject();
-		testSubject.setTotalResults(totalResults);
-	}
-
-	@Test
-	public void testSetFrom() throws Exception {
-		GetMultipleDataResult testSubject;
-		int from = 0;
-
-		// default test
-		testSubject = createTestSubject();
-		testSubject.setFrom(from);
-	}
-
-	@Test
-	public void testSetTo() throws Exception {
-		GetMultipleDataResult testSubject;
-		int to = 0;
-
-		// default test
-		testSubject = createTestSubject();
-		testSubject.setTo(to);
-	}
-
-	@Test
-	public void testGetQueryDuration() throws Exception {
-		GetMultipleDataResult testSubject;
-		long result;
-
-		// default test
-		testSubject = createTestSubject();
-		result = testSubject.getQueryDuration();
-	}
-
-	@Test
-	public void testGetTotalResults() throws Exception {
-		GetMultipleDataResult testSubject;
-		long result;
-
-		// default test
-		testSubject = createTestSubject();
-		result = testSubject.getTotalResults();
-	}
-
-	@Test
-	public void testGetFrom() throws Exception {
-		GetMultipleDataResult testSubject;
-		int result;
-
-		// default test
-		testSubject = createTestSubject();
-		result = testSubject.getFrom();
-	}
-
-	@Test
-	public void testGetTo() throws Exception {
-		GetMultipleDataResult testSubject;
-		int result;
-
-		// default test
-		testSubject = createTestSubject();
-		result = testSubject.getTo();
+	public void shouldHaveValidGettersAndSetters(){
+		assertThat(GetMultipleDataResultTest.class, hasValidGettersAndSetters());
 	}
 }
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 0839407..fdbc5b5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -90,6 +90,7 @@
         <testng.version>6.9.10</testng.version>
         <extentreports.version>3.0.3</extentreports.version>
         <cucumber.version>2.3.1</cucumber.version>
+        <bean-matchers.version>0.11</bean-matchers.version>
 
         <!-- parser-->
         <sdc-tosca-parser.version>1.2.3-SNAPSHOT</sdc-tosca-parser.version>