Added junit test cases 90/107690/1
authorezhil <ezhrajam@in.ibm.com>
Thu, 14 May 2020 14:25:05 +0000 (19:55 +0530)
committerezhil <ezhrajam@in.ibm.com>
Thu, 14 May 2020 14:25:20 +0000 (19:55 +0530)
Added Junit testcases for module so/bean as fix Sonar blocker issue
Issue-ID: USECASEUI-439
Change-Id: Ib7fa250362e462b3753111a9f464dcd543aa4b2c
Signed-off-by: ezhil <ezhrajam@in.ibm.com>
server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationProgressInformationTest.java
server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/OperationTest.java
server/src/test/java/org/onap/usecaseui/server/service/lcm/domain/so/bean/ServiceOperationTest.java

index 587d13e..0fedc2d 100644 (file)
@@ -1,6 +1,9 @@
 /**
  * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved.
  *
+ * ================================================================================
+ *  Modifications Copyright (C) 2020 IBM.
+ * ================================================================================
  * 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
@@ -40,6 +43,8 @@ import org.hibernate.Transaction;
 import mockit.Mock;
 import mockit.MockUp;
 
+import static org.junit.Assert.assertEquals;
+
 public class OperationProgressInformationTest {
 
        @Before
@@ -51,9 +56,16 @@ public class OperationProgressInformationTest {
        }
 
        @Test
-       public void testOperationProgressInformation() throws Exception {
+       public void testGet() throws Exception {
                OperationProgressInformation opi = new OperationProgressInformation();
-               opi.setOperationStatus(null);
-               opi.getOperationStatus();
+               OperationProgress op = new OperationProgress("123","test","test","test","test","test","test","test",123,"test","test");
+               opi.setOperationStatus(op);
+               assertEquals(op,opi.getOperationStatus());
+       }
+       @Test
+       public void testConstructor() throws Exception {
+               OperationProgress op = new OperationProgress("123","test","test","test","test","test","test","test",123,"test","test");
+               OperationProgressInformation opi = new OperationProgressInformation(op);
+               assertEquals(op,opi.getOperationStatus());
        }
 }
index 2fdd204..d8e9895 100644 (file)
@@ -1,6 +1,9 @@
 /**
  * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved.
  *
+ * ================================================================================
+ * Modifications Copyright (C) 2020 IBM.
+ * ================================================================================
  * 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
@@ -40,6 +43,8 @@ import org.hibernate.Transaction;
 import mockit.Mock;
 import mockit.MockUp;
 
+import static org.junit.Assert.assertEquals;
+
 public class OperationTest {
 
        @Before
@@ -53,9 +58,9 @@ public class OperationTest {
        @Test
        public void testOperation() throws Exception {
                Operation o = new Operation();
-               o.setServiceId("");
-               o.setOperationId("");
-               o.getServiceId();
-               o.getOperationId();
+               o.setServiceId("123");
+               o.setOperationId("123");
+               assertEquals("123",o.getServiceId());
+               assertEquals("123",o.getOperationId());
        }
 }
index 56fd4bb..268bb85 100644 (file)
@@ -1,6 +1,9 @@
 /**
  * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved.
  *
+ * ================================================================================
+ * Modifications Copyright (C) 2020 IBM.
+ * ================================================================================
  * 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
@@ -40,6 +43,8 @@ import org.hibernate.Transaction;
 import mockit.Mock;
 import mockit.MockUp;
 
+import static org.junit.Assert.assertEquals;
+
 public class ServiceOperationTest {
 
        @Before
@@ -53,7 +58,10 @@ public class ServiceOperationTest {
        @Test
        public void testServiceOperation() throws Exception {
                ServiceOperation so = new ServiceOperation();
-               so.setService(null);
-               so.getService();
+               Operation o = new Operation();
+               o.setServiceId("123");
+               o.setOperationId("123");
+               so.setService(o);
+               assertEquals(o,so.getService());
        }
 }