Improve test coverage in UserJsonDecoder 65/86365/3
authorm.kowalski3 <m.kowalski3@partner.samsung.com>
Fri, 26 Apr 2019 07:30:35 +0000 (09:30 +0200)
committerm.kowalski3 <m.kowalski3@partner.samsung.com>
Tue, 30 Apr 2019 11:28:39 +0000 (13:28 +0200)
Change-Id: I891e78720d47c015ab4f9e130f345797b0110d64
Issue-ID: CLAMP-348
Signed-off-by: Marcin Kowalski <m.kowalski3@partner.samsung.com>
src/test/java/org/onap/clamp/clds/config/CldsUserJsonDecoderTest.java
src/test/resources/clds/clds-parse-exception.json [new file with mode: 0644]

index a32a603..549c913 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017 AT&T Intellectual Property. All rights
  *                             reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
  * 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
 package org.onap.clamp.clds.config;
 
 import static org.assertj.core.api.Assertions.assertThat;
-
 import org.junit.Test;
+import org.onap.clamp.clds.exception.CldsUsersException;
 import org.onap.clamp.clds.service.CldsUser;
 
+
 public class CldsUserJsonDecoderTest {
 
     private String user1 = "admin1";
@@ -92,4 +95,12 @@ public class CldsUserJsonDecoderTest {
         assertThat(user.getPassword()).isEqualTo(password);
         assertThat(user.getPermissionsString()).isEqualTo(incompletePermissionsArray);
     }
+
+    @Test(expected = CldsUsersException.class)
+    public void shouldThrowCldsUsersException() {
+        //when
+        CldsUserJsonDecoder
+                .decodeJson(this.getClass().getResourceAsStream("/clds/clds-parse-exception.json"));
+    }
+
 }
diff --git a/src/test/resources/clds/clds-parse-exception.json b/src/test/resources/clds/clds-parse-exception.json
new file mode 100644 (file)
index 0000000..1c06a39
--- /dev/null
@@ -0,0 +1 @@
+This is not json
\ No newline at end of file