diff options
author | amshegokar <AS00500801@techmahindra.com> | 2018-01-30 18:20:05 +0530 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2018-01-31 20:50:28 +0000 |
commit | 03f48c7ea7de11d7c7d0933a0438afa4280e3bf7 (patch) | |
tree | aaebe87ed8e39074c364374570d4d918ac0ea21a /appc-dg | |
parent | 6838f60cbfeccdb42c37f3fd40f839692ee10d76 (diff) |
Unit Tests for appc-dg-mdsal-store classes-Part 1
Adding Unit test for
org.onap.appc.mdsal.operation package
https://sonar.onap.org/drilldown/measures/org.onap.appc:appc?highlight=overall_coverage&metric=overall_uncovered_lines&rids%5B%5D=117465&rids%5B%5D=124943
Change-Id: I8c5b08406b5308dcfef1fd71826f9d8bc908e908
Issue-ID: APPC-501
Signed-off-by: amshegokar <AS00500801@techmahindra.com>
Diffstat (limited to 'appc-dg')
-rw-r--r-- | appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/test/java/org/onap/appc/mdsal/operation/TestConfigOperationRequestFormatter.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/test/java/org/onap/appc/mdsal/operation/TestConfigOperationRequestFormatter.java b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/test/java/org/onap/appc/mdsal/operation/TestConfigOperationRequestFormatter.java new file mode 100644 index 000000000..a55bd8153 --- /dev/null +++ b/appc-dg/appc-dg-shared/appc-dg-mdsal-store/appc-dg-mdsal-bundle/src/test/java/org/onap/appc/mdsal/operation/TestConfigOperationRequestFormatter.java @@ -0,0 +1,47 @@ +package org.onap.appc.mdsal.operation; + +import static org.junit.Assert.*; +import org.junit.Before; +import org.junit.Test; + +public class TestConfigOperationRequestFormatter { + private ConfigOperationRequestFormatter requestFormatter; + + @Before + public void setUp() { + requestFormatter = new ConfigOperationRequestFormatter(); + } + + @Test + public void testBuildPath_ValidPath() { + String validBuildPath = "/restconf/config/appc-dg-mdsal-store:appc-dg-mdsal-bundle/appc-dg-mdsal-bundle/appc-dg-mdsal-model/"; + String module = "appc-dg-mdsal-store"; + String containerName = "appc-dg-mdsal-bundle"; + String[] subModules = { "appc-dg-mdsal-bundle", "appc-dg-mdsal-model" }; + assertEquals(validBuildPath, requestFormatter.buildPath(module, containerName, subModules)); + } + @Test + public void testBuildPath_One_SubModule() { + String validBuildPath = "/restconf/config/appc-dg-mdsal-store:appc-dg-mdsal-bundle/appc-dg-mdsal-bundle/"; + String module = "appc-dg-mdsal-store"; + String containerName = "appc-dg-mdsal-bundle"; + String[] subModules = { "appc-dg-mdsal-bundle"}; + assertEquals(validBuildPath, requestFormatter.buildPath(module, containerName, subModules)); + } + @Test + public void testBuildPath_Zero_SubModule() { + String validBuildPathWithoutSubModule = "/restconf/config/appc-dg-mdsal-store:appc-dg-mdsal-bundle/"; + String module = "appc-dg-mdsal-store"; + String containerName = "appc-dg-mdsal-bundle"; + assertEquals(validBuildPathWithoutSubModule, requestFormatter.buildPath(module, containerName)); + } + @Test + public void testBuildPath_InvalidPath() { + String inValidBuildPath = "/restcon/config/appc-dg-mdsal-storeappc-dg-mdsal-bundle/appc-dg-mdsal-bundle/appc-dg-mdsal-model/"; + String module = "appc-dg-mdsal-store"; + String containerName = "appc-dg-mdsal-bundle"; + String[] subModules = { "appc-dg-mdsal-bundle", "appc-dg-mdsal-model" }; + assertNotEquals(inValidBuildPath, requestFormatter.buildPath(module, containerName,subModules)); + + } +} |