From 9cbca383a8fdd1c079f35ceecb8787a70a15c585 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Thu, 24 May 2018 13:24:12 -0400 Subject: Don't build credentials if user name is empty Modified code to skip building credentials if user name is empty, in addition to case where user name is null. Change-Id: I5b53d4f97263df98cfe082f44a4e6af64b1e488b Issue-ID: POLICY-868 Signed-off-by: Jim Hahn --- .../rest/src/test/java/org/onap/policy/rest/TestGet.java | 10 ++++++++++ .../rest/src/test/java/org/onap/policy/rest/TestPost.java | 7 +++++++ 2 files changed, 17 insertions(+) (limited to 'controlloop/common/model-impl/rest/src/test/java') diff --git a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestGet.java b/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestGet.java index a2252a046..a8301810c 100755 --- a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestGet.java +++ b/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestGet.java @@ -44,6 +44,16 @@ public class TestGet { assertTrue(result.b.length() > 0); } + @Test + public void testUsernameEmpty() { + RESTManager mgr = new RESTManager(); + + Pair result = mgr.get("http://www.example.org", "", null, null); + assertEquals((Integer)200, result.a); + assertTrue(result.b != null); + assertTrue(result.b.length() > 0); + } + @Test public void testUrlExampleOrg() { RESTManager mgr = new RESTManager(); diff --git a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestPost.java b/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestPost.java index de44dec6b..58ba5d247 100755 --- a/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestPost.java +++ b/controlloop/common/model-impl/rest/src/test/java/org/onap/policy/rest/TestPost.java @@ -34,6 +34,13 @@ public class TestPost { assertEquals(null, result); } + @Test + public void testUsernameEmpty() { + RESTManager mgr = new RESTManager(); + Pair result = mgr.post("http://www.example.org", "", null, null, null, null); + assertEquals(null, result); + } + @Test public void testBodyNull() { RESTManager mgr = new RESTManager(); -- cgit 1.2.3-korg