aboutsummaryrefslogtreecommitdiffstats
path: root/BRMSGateway/src/test
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@ericsson.com>2018-04-24 23:47:45 +0100
committerliamfallon <liam.fallon@ericsson.com>2018-04-24 23:54:17 +0100
commit303742b965387dacfeedda939323424716cf9b7c (patch)
tree116bcf136d0c99e57c3242c18a770990776fcfee /BRMSGateway/src/test
parent30b44d3e752d44f8f870594a05464c9e1c5158b6 (diff)
Add JUnit for direct Sonar Nexus REST interface
JUnit tests and changes to the source code to fix issues that were identified in JUnit testing. JUnit testing runs tests towards the Nexus server at https://nexus.onap.org If that server does not exist then the unit tests will fail but as the nexus serveir is required for the build to work then it should be OK to use that server for unit testing. This removes the need to write complex (and less effective) Mockito type unit tests. Issue-ID: POLICY-700 Change-Id: I4aa33a1022033b42bb1fd1fa36785a8e0216b887 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'BRMSGateway/src/test')
-rw-r--r--BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/NexusRestWrapperTest.java372
-rw-r--r--BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusArtifactHitTest.java39
-rw-r--r--BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusArtifactLinkTest.java39
-rw-r--r--BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusArtifactTest.java50
-rw-r--r--BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusRepositoryTest.java43
-rw-r--r--BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusSearchResultTest.java45
6 files changed, 578 insertions, 10 deletions
diff --git a/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/NexusRestWrapperTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/NexusRestWrapperTest.java
index 489014e52..bc666fb08 100644
--- a/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/NexusRestWrapperTest.java
+++ b/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/NexusRestWrapperTest.java
@@ -20,7 +20,10 @@
package org.onap.policy.brms.api.nexus;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.util.List;
@@ -31,22 +34,371 @@ import org.onap.policy.brms.api.nexus.NexusRestWrapperException;
import org.onap.policy.brms.api.nexus.pojo.NexusArtifact;
public class NexusRestWrapperTest {
+ @Test
+ public void testRestWrapperConstructionErrors() throws NexusRestWrapperException {
+ try {
+ new NexusRestWrapper(null, null, null);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("nexusServerUrl must be specified for the Nexus server", e.getMessage());
+ }
+
+ try {
+ new NexusRestWrapper("", null, null);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("nexusServerUrl must be specified for the Nexus server", e.getMessage());
+ }
+
+ try {
+ new NexusRestWrapper(" ", null, null);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("nexusServerUrl must be specified for the Nexus server", e.getMessage());
+ }
+
+ try {
+ new NexusRestWrapper("\n\t", null, null);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("nexusServerUrl must be specified for the Nexus server", e.getMessage());
+ }
+
+ try {
+ new NexusRestWrapper("server", "user", null);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("if either nexusUser or nexusPassword are specified, both must be specified", e.getMessage());
+ }
+
+ try {
+ new NexusRestWrapper("server", null, "pass");
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("if either nexusUser or nexusPassword are specified, both must be specified", e.getMessage());
+ }
+
+ NexusRestWrapper wrapper = new NexusRestWrapper("http://localhost:99999", "user", "pass");
+ assertNotNull(wrapper);
+
+ try {
+ wrapper.findArtifact(null);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("searchParameters may not be null", e.getMessage());
+ }
+
+ try {
+ wrapper.findArtifact(new NexusRestSearchParameters());
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("search parameters have not been set", e.getMessage());
+ }
+
+ try {
+ NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
+
+ searchParameters.useFilterSearch("org.onap.policy.engine", null, null, null, null);
+ wrapper.findArtifact(searchParameters);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("search to URI http://localhost:99999/service/local/lucene/search?g=org.onap.policy.engine "
+ + "failed with message: java.lang.IllegalArgumentException: port out of range:99999",
+ e.getMessage());
+ }
+
+ wrapper.close();
+ wrapper = new NexusRestWrapper("http://localhost:57344", "user", "pass");
+
+ try {
+ NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
+
+ searchParameters.useFilterSearch("org.onap.policy.engine", null, null, null, null);
+ wrapper.findArtifact(searchParameters);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("search to URI http://localhost:57344/service/local/lucene/search?g=org.onap.policy.engine "
+ + "failed with message: java.net.ConnectException: Connection refused (Connection refused)",
+ e.getMessage());
+ }
+
+ wrapper.close();
+ wrapper = new NexusRestWrapper("https://nexus.onap.org", "user", "pass");
+
+ try {
+ NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
+ searchParameters.useFilterSearch("org.onap.policy.engine", null, "", null, null);
+ wrapper.findArtifact(searchParameters);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("search to URI https://nexus.onap.org/service/local/lucene/search?g=org.onap.policy.engine "
+ + "failed, response was: InboundJaxrsResponse{context=ClientResponse{method=GET, "
+ + "uri=https://nexus.onap.org/service/local/lucene/search?g=org.onap.policy.engine, status=401, reason=Unauthorized}}",
+ e.getMessage());
+ }
+
+ try {
+ NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
+ searchParameters.useFilterSearch(null, null, null, null, null);
+ wrapper.findArtifact(searchParameters);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("at least one filter parameter must be specified for Nexus filter searches", e.getMessage());
+ }
+
+ try {
+ NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
+ searchParameters.useKeywordSearch(null);
+ wrapper.findArtifact(searchParameters);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("keyword must be specified for Nexus keyword searches", e.getMessage());
+ }
+
+ try {
+ NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
+ searchParameters.useClassNameSearch(null);
+ wrapper.findArtifact(searchParameters);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("className must be specified for Nexus class name searches", e.getMessage());
+ }
+
+ try {
+ NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
+ searchParameters.useChecksumSearch(null);
+ wrapper.findArtifact(searchParameters);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("checksum must be specified for Nexus checksum searches", e.getMessage());
+ }
+
+ try {
+ NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
+ searchParameters.useKeywordSearch("BRMSGateway").setRepositoryId(null);
+ wrapper.findArtifact(searchParameters);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("a repositoryId must be specified", e.getMessage());
+ }
+
+ try {
+ NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
+ searchParameters.useKeywordSearch("BRMSGateway").setFrom(-1);
+ wrapper.findArtifact(searchParameters);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("from cannot be less than 0 when from is specified", e.getMessage());
+ }
+
+ try {
+ NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
+ searchParameters.useKeywordSearch("BRMSGateway").setCount(0);
+ wrapper.findArtifact(searchParameters);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("count cannot be less than 1 when count is specified", e.getMessage());
+ }
+
+ try {
+ NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
+ searchParameters.useKeywordSearch("BRMSGateway");
+ searchParameters.getSearchUri(null);
+ fail("test shold throw an exception here");
+ } catch (NexusRestWrapperException e) {
+ assertEquals("nexusServerUrl must be specified for the search URI", e.getMessage());
+ }
+
+ wrapper.close();
+ }
@Test
- public void test() throws NexusRestWrapperException {
- NexusRestWrapper wrapper = new NexusRestWrapper("https://nexus.onap.org");
-
+ public void testGetters() throws NexusRestWrapperException {
NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
- searchParameters.useFilterSearch("org.onap.policy.engine", "BRMSGateway", null, null, null);
- List<NexusArtifact> foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ searchParameters.useKeywordSearch("BRMSGateway");
+ assertEquals(NexusRestSearchParameters.SearchType.KEYWORD, searchParameters.getSearchType());
+ assertEquals(null, searchParameters.getArtifactId());
+ assertEquals(null, searchParameters.getChecksum());
+ assertEquals(null, searchParameters.getClassName());
+ assertEquals(null, searchParameters.getClassifier());
+ assertEquals(-1, searchParameters.getCount());
+ assertEquals(-1, searchParameters.getFrom());
+ assertEquals(null, searchParameters.getGroupId());
+ assertEquals("BRMSGateway", searchParameters.getKeyword());
+ assertEquals(null, searchParameters.getPackagingType());
+ assertEquals(null, searchParameters.getRepositoryId());
+ assertEquals(null, searchParameters.getVersion());
+ searchParameters.useFilterSearch("org.onap.policy.engine", "BRMSGateway",
+ "1.2.3", "jar", "jar-with-dependencies")
+ .setFrom(100).setCount(10).setRepositoryId("repository");
+ assertEquals(NexusRestSearchParameters.SearchType.FILTER, searchParameters.getSearchType());
+ assertEquals("BRMSGateway", searchParameters.getArtifactId());
+ assertEquals(null, searchParameters.getChecksum());
+ assertEquals(null, searchParameters.getClassName());
+ assertEquals("jar-with-dependencies", searchParameters.getClassifier());
+ assertEquals(10, searchParameters.getCount());
+ assertEquals(100, searchParameters.getFrom());
+ assertEquals("org.onap.policy.engine", searchParameters.getGroupId());
+ assertEquals(null, searchParameters.getKeyword());
+ assertEquals("jar", searchParameters.getPackagingType());
+ assertEquals("repository", searchParameters.getRepositoryId());
+ assertEquals("1.2.3", searchParameters.getVersion());
+
+ searchParameters.useClassNameSearch("BRMSGateway");
+ assertEquals(NexusRestSearchParameters.SearchType.CLASS_NAME, searchParameters.getSearchType());
+ assertEquals(null, searchParameters.getArtifactId());
+ assertEquals(null, searchParameters.getChecksum());
+ assertEquals("BRMSGateway", searchParameters.getClassName());
+ assertEquals(null, searchParameters.getClassifier());
+ assertEquals(-1, searchParameters.getCount());
+ assertEquals(-1, searchParameters.getFrom());
+ assertEquals(null, searchParameters.getGroupId());
+ assertEquals(null, searchParameters.getKeyword());
+ assertEquals(null, searchParameters.getPackagingType());
+ assertEquals(null, searchParameters.getRepositoryId());
+ assertEquals(null, searchParameters.getVersion());
+
+ searchParameters.useChecksumSearch("987654321");
+ assertEquals(NexusRestSearchParameters.SearchType.CHECKSUM, searchParameters.getSearchType());
+ assertEquals(null, searchParameters.getArtifactId());
+ assertEquals("987654321", searchParameters.getChecksum());
+ assertEquals(null, searchParameters.getClassName());
+ assertEquals(null, searchParameters.getClassifier());
+ assertEquals(-1, searchParameters.getCount());
+ assertEquals(-1, searchParameters.getFrom());
+ assertEquals(null, searchParameters.getGroupId());
+ assertEquals(null, searchParameters.getKeyword());
+ assertEquals(null, searchParameters.getPackagingType());
+ assertEquals(null, searchParameters.getRepositoryId());
+ assertEquals(null, searchParameters.getVersion());
+ }
+
+ @Test
+ public void testFilterSearch() throws NexusRestWrapperException {
+ NexusRestWrapper wrapper = new NexusRestWrapper("https://nexus.onap.org", null, null);
+
+ NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
+
+ searchParameters.useFilterSearch("org.onap.policy.dorothy", null, null, null, null).setCount(1);
+ List<NexusArtifact> foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
assertNotNull(foundArtifactList);
-
- for (NexusArtifact artifact: foundArtifactList) {
- System.out.println(artifact.getUrlPath());
- }
-
+ assertEquals(0, foundArtifactList.size());
+
+ searchParameters.useFilterSearch("org.onap.policy.engine", null, null, null, null).setCount(1);
+ foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(1, foundArtifactList.size());
+
+ searchParameters.useFilterSearch("org.onap.policy.engine", null, null, null, null).setFrom(2).setCount(2);
+ foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(2, foundArtifactList.size());
+
+ searchParameters.useFilterSearch("org.onap.policy.engine", null, null, null, null).setFrom(2).setCount(2);
+ foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(2, foundArtifactList.size());
+
+ searchParameters.useFilterSearch(null, "BRMSGateway", null, null, null);
+ foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertTrue(foundArtifactList.size() > 2);
+
+ searchParameters.useFilterSearch(null, null, "1.2.3", null, null).setCount(1);
+ foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(1, foundArtifactList.size());
+
+ searchParameters.useFilterSearch("org.onap.policy.engine", null, "1.1.2", null, null).setCount(1);
+ foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(1, foundArtifactList.size());
+
+ searchParameters.useFilterSearch("org.onap.policy.engine", "BRMSGateway", "1.1.2", null, null).setCount(1);
+ foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(1, foundArtifactList.size());
+
+ searchParameters.useFilterSearch(null, "BRMSGateway", "1.1.2", null, null).setCount(1);
+ foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(1, foundArtifactList.size());
+
+ searchParameters.useFilterSearch(null, "BRMSGateway", "1.1.2", "jar", null).setCount(1);
+ foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(1, foundArtifactList.size());
+
+ searchParameters.useFilterSearch(null, "BRMSGateway", "1.1.2", "jar", "jar-with-dependencies").setCount(1);
+ foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(1, foundArtifactList.size());
+
+ searchParameters.useFilterSearch(null, "BRMSGateway", "1.1.2", "jar", "jar-with-dependencies")
+ .setCount(1).setRepositoryId("releases");
+ foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(1, foundArtifactList.size());
+
+ wrapper.close();
+ }
+
+ @Test
+ public void testKeywordSearch() throws NexusRestWrapperException {
+ NexusRestWrapper wrapper = new NexusRestWrapper("https://nexus.onap.org", null, null);
+
+ NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
+
+ searchParameters.useKeywordSearch("TheWizardOfOz").setCount(1);
+ List<NexusArtifact> foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(0, foundArtifactList.size());
+
+ searchParameters.useKeywordSearch("BRMSGateway").setCount(1);
+ foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(1, foundArtifactList.size());
+
+ wrapper.close();
+ }
+
+ @Test
+ public void testClassNameSearch() throws NexusRestWrapperException {
+ NexusRestWrapper wrapper = new NexusRestWrapper("https://nexus.onap.org", null, null);
+
+ NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
+
+ searchParameters.useClassNameSearch("TheWizardOfOz").setCount(1);
+ List<NexusArtifact> foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(0, foundArtifactList.size());
+
+ searchParameters.useClassNameSearch("BRMSGateway").setCount(1);
+ foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(1, foundArtifactList.size());
+
+ wrapper.close();
+ }
+
+ @Test
+ public void testChecksumSearch() throws NexusRestWrapperException {
+ NexusRestWrapper wrapper = new NexusRestWrapper("https://nexus.onap.org", null, null);
+
+ NexusRestSearchParameters searchParameters = new NexusRestSearchParameters();
+
+ searchParameters.useChecksumSearch("99999999999999").setCount(1);
+ List<NexusArtifact> foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(0, foundArtifactList.size());
+
+ searchParameters.useChecksumSearch("914acda2ce67de9b45d599109d6ad8357d01b217").setCount(1);
+ foundArtifactList = wrapper.findArtifact(searchParameters).getArtifactList();
+ assertNotNull(foundArtifactList);
+ assertEquals(1, foundArtifactList.size());
+
wrapper.close();
}
}
diff --git a/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusArtifactHitTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusArtifactHitTest.java
new file mode 100644
index 000000000..f04884660
--- /dev/null
+++ b/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusArtifactHitTest.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2018 Ericsson Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.brms.api.nexus.pojo;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+public class NexusArtifactHitTest {
+
+ @Test
+ public void testNexusArtifactHit() {
+ NexusArtifactHit artifactHit = new NexusArtifactHit();
+
+ assertNull(artifactHit.getArtifactLinks());
+ assertNull(artifactHit.getRepositoryId());
+
+ assertNotNull(artifactHit.toString());
+ }
+}
diff --git a/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusArtifactLinkTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusArtifactLinkTest.java
new file mode 100644
index 000000000..b0ae02e9c
--- /dev/null
+++ b/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusArtifactLinkTest.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2018 Ericsson Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.brms.api.nexus.pojo;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+public class NexusArtifactLinkTest {
+
+ @Test
+ public void testNexusArtifactLink() {
+ NexusArtifactLink artifactLink = new NexusArtifactLink();
+
+ assertNull(artifactLink.getClassifier());
+ assertNull(artifactLink.getExtension());
+
+ assertNotNull(artifactLink.toString());
+ }
+}
diff --git a/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusArtifactTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusArtifactTest.java
new file mode 100644
index 000000000..e8ddaabe9
--- /dev/null
+++ b/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusArtifactTest.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2018 Ericsson Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.brms.api.nexus.pojo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+public class NexusArtifactTest {
+
+ @Test
+ public void testNexusArtifact() {
+ NexusArtifact artifact = new NexusArtifact();
+
+ assertNull(artifact.getGroupId());
+ assertNull(artifact.getArtifactId());
+ assertNull(artifact.getVersion());
+ assertNull(artifact.getHighlightedFragment());
+ assertNull(artifact.getLatestRelease());
+ assertNull(artifact.getLatestReleaseRepositoryId());
+ assertNull(artifact.getLatestSnapshot());
+ assertNull(artifact.getLatestSnapshotRepositoryId());
+ assertNull(artifact.getArtifactHits());
+
+ artifact.setUrlPath("urlPath");
+ assertEquals("urlPath", artifact.getUrlPath());
+
+ assertNotNull(artifact.toString());
+ }
+}
diff --git a/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusRepositoryTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusRepositoryTest.java
new file mode 100644
index 000000000..41f710386
--- /dev/null
+++ b/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusRepositoryTest.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2018 Ericsson Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.brms.api.nexus.pojo;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+public class NexusRepositoryTest {
+
+ @Test
+ public void testNexusRepository() {
+ NexusRepository repository = new NexusRepository();
+
+ assertNull(repository.getRepositoryId());
+ assertNull(repository.getRepositoryKind());
+ assertNull(repository.getRepositoryContentClass());
+ assertNull(repository.getRepositoryName());
+ assertNull(repository.getRepositoryPolicy());
+ assertNull(repository.getRepositoryUrl());
+
+ assertNotNull(repository.toString());
+ }
+}
diff --git a/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusSearchResultTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusSearchResultTest.java
new file mode 100644
index 000000000..ba83a3a27
--- /dev/null
+++ b/BRMSGateway/src/test/java/org/onap/policy/brms/api/nexus/pojo/NexusSearchResultTest.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2018 Ericsson Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.brms.api.nexus.pojo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.junit.Test;
+
+public class NexusSearchResultTest {
+
+ @Test
+ public void testNexusSearchResult() {
+ NexusSearchResult result = new NexusSearchResult();
+
+ assertNull(result.getArtifactList());
+ assertEquals(0, result.getCount());
+ assertEquals(0, result.getFrom());
+ assertNull(result.getRepoDetailsList());
+ assertEquals(0, result.getTotalCount());
+ assertEquals(false, result.isCollapsed());
+ assertEquals(false, result.isTooManyResults());
+
+ assertNotNull(result.toString());
+ }
+}