summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Nelson <nelson24@att.com>2019-01-25 18:40:05 +0000
committerGerrit Code Review <gerrit@onap.org>2019-01-25 18:40:05 +0000
commit95489883ce973e84267fcbcee685f1598d4bdd6e (patch)
treee7789b9fdcefa8bc249f6fa44fe81f7c28e32ecd
parent068d42850aacf57e965302dddd99b35b350efcc4 (diff)
parent1dcbea199fbdb7159eb5fc8a97f0a69287d40ab8 (diff)
Merge "added test cases to JsonResponseTest.java"release-3.0.24
-rw-r--r--src/test/java/org/onap/music/unittests/JsonResponseTest.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/test/java/org/onap/music/unittests/JsonResponseTest.java b/src/test/java/org/onap/music/unittests/JsonResponseTest.java
index 9da10638..781cdd7b 100644
--- a/src/test/java/org/onap/music/unittests/JsonResponseTest.java
+++ b/src/test/java/org/onap/music/unittests/JsonResponseTest.java
@@ -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
@@ -23,8 +25,11 @@
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);
+
+ }
}