summaryrefslogtreecommitdiffstats
path: root/common/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/test')
-rw-r--r--common/src/test/java/org/onap/so/serviceinstancebeans/ModelTypeTest.java38
-rw-r--r--common/src/test/java/org/onap/so/serviceinstancebeans/TestServiceInstanceBean.java24
2 files changed, 62 insertions, 0 deletions
diff --git a/common/src/test/java/org/onap/so/serviceinstancebeans/ModelTypeTest.java b/common/src/test/java/org/onap/so/serviceinstancebeans/ModelTypeTest.java
new file mode 100644
index 0000000000..e4b694cd15
--- /dev/null
+++ b/common/src/test/java/org/onap/so/serviceinstancebeans/ModelTypeTest.java
@@ -0,0 +1,38 @@
+package org.onap.so.serviceinstancebeans;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import org.junit.Test;
+
+public class ModelTypeTest {
+
+
+
+ @Test
+ public void reflectionTest() {
+ TestServiceInstanceBean a = new TestServiceInstanceBean();
+ TestServiceInstanceBean b = new TestServiceInstanceBean();
+
+ a.setServiceInstanceId("my-id-a");
+ a.setServiceInstanceName("my-name-a");
+
+ b.setServiceInstanceId("my-id-b");
+ b.setServiceInstanceName("my-name-b");
+
+ assertEquals("my-id-a", ModelType.service.getId(a));
+ assertEquals("my-name-a", ModelType.service.getName(a));
+ ModelType.service.setName(a, ModelType.service.getName(b));
+ ModelType.service.setId(a, ModelType.service.getId(b));
+ assertEquals("my-name-b", ModelType.service.getName(a));
+ assertEquals("my-id-b", ModelType.service.getId(a));
+ }
+
+ @Test
+ public void testSilentFail() {
+ TestServiceInstanceBean a = new TestServiceInstanceBean();
+
+ a.setServiceInstanceId("my-id-a");
+ a.setServiceInstanceName("my-name-a");
+ assertNull(ModelType.service.get(a, "NoField"));
+ }
+}
diff --git a/common/src/test/java/org/onap/so/serviceinstancebeans/TestServiceInstanceBean.java b/common/src/test/java/org/onap/so/serviceinstancebeans/TestServiceInstanceBean.java
new file mode 100644
index 0000000000..b8cf6141e3
--- /dev/null
+++ b/common/src/test/java/org/onap/so/serviceinstancebeans/TestServiceInstanceBean.java
@@ -0,0 +1,24 @@
+package org.onap.so.serviceinstancebeans;
+
+public class TestServiceInstanceBean {
+
+ private String serviceInstanceId;
+ private String serviceInstanceName;
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+}