aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-09-18 12:27:51 +0200
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-09-18 12:27:51 +0200
commiteaea5ad06aa510cbf36bb95c920932ab6de0e6de (patch)
treedc757027373b658c776765a26698ad8d4bad9d74 /src/test/java
parentaf0fbf9edb92544380d40ab2cffb87c89831944f (diff)
Reformat the JSON and fix checkstyle issue
All Json used in the tests have been reformatted. Also some checkstyle bugs have been fixed Change-Id: I48373d9d53d39244c62b9b88b1cf62c15c766cb3 Issue-ID: CLAMP-54 Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/onap/clamp/clds/it/CldsServiceIT.java3
-rw-r--r--src/test/java/org/onap/clamp/clds/model/CldsModelTest.java80
2 files changed, 28 insertions, 55 deletions
diff --git a/src/test/java/org/onap/clamp/clds/it/CldsServiceIT.java b/src/test/java/org/onap/clamp/clds/it/CldsServiceIT.java
index 96131197..f09c3577 100644
--- a/src/test/java/org/onap/clamp/clds/it/CldsServiceIT.java
+++ b/src/test/java/org/onap/clamp/clds/it/CldsServiceIT.java
@@ -94,8 +94,7 @@ public class CldsServiceIT extends AbstractIT {
assertTrue(cldsInfo.isPermissionUpdateTemplate());
Properties prop = new Properties();
- // InputStream in =
- // CldsInfo.class.getResourceAsStream("clds-version.properties");
+
InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("clds-version.properties");
prop.load(in);
in.close();
diff --git a/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java b/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java
index 0333bdb7..22986781 100644
--- a/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java
+++ b/src/test/java/org/onap/clamp/clds/model/CldsModelTest.java
@@ -58,22 +58,19 @@ public class CldsModelTest {
cldsModel.validateAction("unknown");
}
- @Test
+ @Test(expected = IllegalArgumentException.class)
public void testValidateActionFromCreate() {
CldsModel cldsModel = new CldsModel();
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_CREATE);
cldsModel.validateAction(CldsEvent.ACTION_SUBMIT);
cldsModel.validateAction(CldsEvent.ACTION_TEST);
- try {
- cldsModel.validateAction(CldsEvent.ACTION_DEPLOY);
- fail("Exception should have been sent");
- } catch (IllegalArgumentException e) {
+ cldsModel.validateAction(CldsEvent.ACTION_DEPLOY);
+ fail("Exception should have been sent");
- }
}
- @Test
+ @Test(expected = IllegalArgumentException.class)
public void testValidateActionFromSubmitOrReSubmit() {
CldsModel cldsModel = new CldsModel();
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_SUBMIT);
@@ -82,35 +79,29 @@ public class CldsModelTest {
cldsModel.validateAction(CldsEvent.ACTION_DEPLOY);
fail("Exception should have been sent");
} catch (IllegalArgumentException e) {
-
+ System.out.println("Exception caught IllegalArgumentException as expected");
}
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_RESUBMIT);
cldsModel.validateAction(CldsEvent.ACTION_RESUBMIT);
- try {
- cldsModel.validateAction(CldsEvent.ACTION_DEPLOY);
- fail("Exception should have been sent");
- } catch (IllegalArgumentException e) {
- }
+ cldsModel.validateAction(CldsEvent.ACTION_DEPLOY);
+ fail("Exception should have been sent");
}
- @Test
+ @Test(expected = IllegalArgumentException.class)
public void testValidateActionFromDistribute() {
CldsModel cldsModel = new CldsModel();
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_DISTRIBUTE);
cldsModel.validateAction(CldsEvent.ACTION_RESUBMIT);
cldsModel.validateAction(CldsEvent.ACTION_DEPLOY);
- try {
- cldsModel.validateAction(CldsEvent.ACTION_CREATE);
- fail("Exception should have been sent");
- } catch (IllegalArgumentException e) {
+ cldsModel.validateAction(CldsEvent.ACTION_CREATE);
+ fail("Exception should have been sent");
- }
}
- @Test
+ @Test(expected = IllegalArgumentException.class)
public void testValidateActionFromUndeploy() {
CldsModel cldsModel = new CldsModel();
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_UNDEPLOY);
@@ -118,15 +109,12 @@ public class CldsModelTest {
cldsModel.validateAction(CldsEvent.ACTION_DEPLOY);
cldsModel.validateAction(CldsEvent.ACTION_RESUBMIT);
- try {
- cldsModel.validateAction(CldsEvent.ACTION_CREATE);
- fail("Exception should have been sent");
- } catch (IllegalArgumentException e) {
+ cldsModel.validateAction(CldsEvent.ACTION_CREATE);
+ fail("Exception should have been sent");
- }
}
- @Test
+ @Test(expected = IllegalArgumentException.class)
public void testValidateActionFromDeploy() {
CldsModel cldsModel = new CldsModel();
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_DEPLOY);
@@ -135,15 +123,12 @@ public class CldsModelTest {
cldsModel.validateAction(CldsEvent.ACTION_UPDATE);
cldsModel.validateAction(CldsEvent.ACTION_STOP);
- try {
- cldsModel.validateAction(CldsEvent.ACTION_CREATE);
- fail("Exception should have been sent");
- } catch (IllegalArgumentException e) {
+ cldsModel.validateAction(CldsEvent.ACTION_CREATE);
+ fail("Exception should have been sent");
- }
}
- @Test
+ @Test(expected = IllegalArgumentException.class)
public void testValidateActionFromRestartOrUpdate() {
CldsModel cldsModel = new CldsModel();
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_RESTART);
@@ -156,7 +141,7 @@ public class CldsModelTest {
cldsModel.validateAction(CldsEvent.ACTION_CREATE);
fail("Exception should have been sent");
} catch (IllegalArgumentException e) {
-
+ System.out.println("Exception caught IllegalArgumentException as expected");
}
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_UPDATE);
@@ -165,16 +150,12 @@ public class CldsModelTest {
cldsModel.validateAction(CldsEvent.ACTION_STOP);
cldsModel.validateAction(CldsEvent.ACTION_UNDEPLOY);
- try {
- cldsModel.validateAction(CldsEvent.ACTION_CREATE);
- fail("Exception should have been sent");
- } catch (IllegalArgumentException e) {
-
- }
+ cldsModel.validateAction(CldsEvent.ACTION_CREATE);
+ fail("Exception should have been sent");
}
- @Test
+ @Test(expected = IllegalArgumentException.class)
public void testValidateActionFromDelete() {
CldsModel cldsModel = new CldsModel();
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_DELETE);
@@ -184,21 +165,18 @@ public class CldsModelTest {
cldsModel.validateAction(CldsEvent.ACTION_CREATE);
fail("Exception should have been sent");
} catch (IllegalArgumentException e) {
-
+ System.out.println("Exception caught IllegalArgumentException as expected");
}
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_DELETE);
cldsModel.getEvent().setActionStateCd(CldsEvent.ACTION_STATE_SENT);
- try {
- cldsModel.validateAction(CldsEvent.ACTION_SUBMIT);
- fail("Exception should have been sent");
- } catch (IllegalArgumentException e) {
+ cldsModel.validateAction(CldsEvent.ACTION_SUBMIT);
+ fail("Exception should have been sent");
- }
}
- @Test
+ @Test(expected = IllegalArgumentException.class)
public void testValidateActionFromStop() {
CldsModel cldsModel = new CldsModel();
cldsModel.getEvent().setActionCd(CldsEvent.ACTION_STOP);
@@ -206,12 +184,8 @@ public class CldsModelTest {
cldsModel.validateAction(CldsEvent.ACTION_RESTART);
cldsModel.validateAction(CldsEvent.ACTION_UNDEPLOY);
- try {
- cldsModel.validateAction(CldsEvent.ACTION_CREATE);
- fail("Exception should have been sent");
- } catch (IllegalArgumentException e) {
-
- }
+ cldsModel.validateAction(CldsEvent.ACTION_CREATE);
+ fail("Exception should have been sent");
}
/**