From eaea5ad06aa510cbf36bb95c920932ab6de0e6de Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Mon, 18 Sep 2017 12:27:51 +0200 Subject: 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) --- .../java/org/onap/clamp/clds/it/CldsServiceIT.java | 3 +- .../org/onap/clamp/clds/model/CldsModelTest.java | 80 ++++++++-------------- 2 files changed, 28 insertions(+), 55 deletions(-) (limited to 'src/test/java/org') 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 96131197b..f09c35778 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 0333bdb78..229867813 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"); } /** -- cgit 1.2.3-korg