added test cases to JsonResponseTest.java 32/76132/1
authorSandeep J <sandeejh@in.ibm.com>
Tue, 22 Jan 2019 14:51:52 +0000 (20:21 +0530)
committerSandeep J <sandeejh@in.ibm.com>
Tue, 22 Jan 2019 14:53:23 +0000 (20:23 +0530)
to increase code coverage

Issue-ID: MUSIC-182
Change-Id: Id617236bf1548f19956a0a03c60ea69808b3bca0
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
src/test/java/org/onap/music/unittests/JsonResponseTest.java

index 9da1063..781cdd7 100644 (file)
@@ -4,6 +4,8 @@
  * ===================================================================
  *  Copyright (c) 2017 AT&T Intellectual Property
  * ===================================================================
+ *  Modifications Copyright (c) 2018-2019 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
 package org.onap.music.unittests;
 
 import static org.junit.Assert.*;
+
+import java.util.HashMap;
 import java.util.Map;
 import org.junit.Test;
+import org.onap.music.lockingservice.MusicLockState.LockStatus;
 import org.onap.music.main.ResultType;
 import org.onap.music.response.jsonobjects.JsonResponse;
 
@@ -80,4 +85,44 @@ public class JsonResponseTest {
         assertEquals(ResultType.FAILURE, myMap.get("status"));
     }
 
+    @Test
+    public void testMessage() {
+        result = new JsonResponse(ResultType.SUCCESS);
+        result.setMessage("message");
+        assertEquals("message", result.getMessage());
+        
+    }
+    
+    @Test
+    public void testDataResult() {
+        result = new JsonResponse(ResultType.SUCCESS);
+        Map<String, HashMap<String, Object>> dataResult= new HashMap<>();
+        result.setDataResult(dataResult);
+        assertEquals(dataResult, result.getDataResult());
+        
+    }
+    
+    @Test
+    public void testLock() {
+        result = new JsonResponse(ResultType.SUCCESS);
+        result.setLock("lock");
+        assertEquals("lock", result.getLock());
+        
+    }
+    
+    @Test
+    public void testLockStatus() {
+        result = new JsonResponse(ResultType.SUCCESS);
+        LockStatus status = LockStatus.LOCKED;
+        result.setLockStatus(status);
+        assertEquals(status, result.getLockStatus());
+        
+    }
+    
+    @Test
+    public void testToString() {
+        result = new JsonResponse(ResultType.SUCCESS);
+        assertTrue(result.toString() instanceof String);
+        
+    }
 }