aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/test')
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/NodeFilterTest.java62
1 files changed, 54 insertions, 8 deletions
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/NodeFilterTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/NodeFilterTest.java
index 72fcf5f2dc..84732e2cdf 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/NodeFilterTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/tosca/model/NodeFilterTest.java
@@ -20,20 +20,66 @@
package org.openecomp.sdc.be.tosca.model;
-import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
-import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
-import static org.hamcrest.MatcherAssert.assertThat;
+import org.junit.jupiter.api.Test;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertFalse;
public class NodeFilterTest {
+
+ private void createCapabilities(NodeFilter nodeFilter) {
+ List<Map<String, CapabilityFilter>> capabilitiesCopy = new ArrayList<>();
+ Map<String, CapabilityFilter> capabilityDataMap = new HashMap<>();
+ CapabilityFilter capabilityFilter = new CapabilityFilter();
+ capabilityDataMap.put("test", capabilityFilter);
+ capabilitiesCopy.add(capabilityDataMap);
+ nodeFilter.setCapabilities(capabilitiesCopy);
+ }
+
+ private void createProperties(NodeFilter nodeFilter) {
+ List<Map<String, List<Object>>> propertiesCopy = new ArrayList<>();
+ Map<String, List<Object>> propertyDataMap = new HashMap<>();
+ List<Object> dataObjectList = new ArrayList<>();
+ Object object = new Object();
+ dataObjectList.add(object);
+ propertyDataMap.put("test", dataObjectList);
+ propertiesCopy.add(propertyDataMap);
+ nodeFilter.setProperties(propertiesCopy);
+ }
+
+ @Test
+ public void testHasDataTrue() {
+ NodeFilter nodeFilter = new NodeFilter();
+ createCapabilities(nodeFilter);
+ createProperties(nodeFilter);
+ boolean result = nodeFilter.hasData();
+ assertTrue(result);
+ }
+
+ @Test
+ public void testHasDataCapabilityTrue() {
+ NodeFilter nodeFilter = new NodeFilter();
+ createCapabilities(nodeFilter);
+ boolean result = nodeFilter.hasData();
+ assertTrue(result);
+ }
+
@Test
- public void testDefaultCtor() {
- assertThat(NodeFilter.class, hasValidBeanConstructor());
+ public void testHasDataPropertiesTrue() {
+ NodeFilter nodeFilter = new NodeFilter();
+ createProperties(nodeFilter);
+ boolean result = nodeFilter.hasData();
+ assertTrue(result);
}
@Test
- public void testGettersSetters() {
- assertThat(NodeFilter.class, hasValidGettersAndSetters());
+ public void testHasDataFalse() {
+ NodeFilter nodeFilter = new NodeFilter();
+ boolean result = nodeFilter.hasData();
+ assertFalse(result);
}
} \ No newline at end of file