Add several JUnits for test coverage
[aaf/authz.git] / cadi / core / src / test / java / org / onap / aaf / cadi / test / JU_CadiException.java
diff --git a/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiException.java b/cadi/core/src/test/java/org/onap/aaf/cadi/test/JU_CadiException.java
new file mode 100644 (file)
index 0000000..fa3b5cc
--- /dev/null
@@ -0,0 +1,121 @@
+/*******************************************************************************\r
+ * ============LICENSE_START====================================================\r
+ * * org.onap.aaf\r
+ * * ===========================================================================\r
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
+ * * ===========================================================================\r
+ * * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * * you may not use this file except in compliance with the License.\r
+ * * You may obtain a copy of the License at\r
+ * * \r
+ *  *      http://www.apache.org/licenses/LICENSE-2.0\r
+ * * \r
+ *  * Unless required by applicable law or agreed to in writing, software\r
+ * * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * * See the License for the specific language governing permissions and\r
+ * * limitations under the License.\r
+ * * ============LICENSE_END====================================================\r
+ * *\r
+ * *\r
+ ******************************************************************************/\r
+package org.onap.aaf.cadi.test;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+import org.onap.aaf.cadi.CadiException;\r
+\r
+import static org.hamcrest.CoreMatchers.is;\r
+\r
+public class JU_CadiException {\r
+       @Test\r
+       public void testCadiException() {\r
+               CadiException exception = new CadiException();\r
+               \r
+               assertNotNull(exception);\r
+       }\r
+\r
+       @Test\r
+       public void testCadiExceptionString() {\r
+               CadiException exception = new CadiException("New Exception");\r
+               assertNotNull(exception);\r
+               assertThat(exception.getMessage(), is("New Exception"));\r
+       }\r
+\r
+       @Test\r
+       public void testCadiExceptionThrowable() {\r
+               CadiException exception = new CadiException(new Throwable("New Exception"));\r
+               assertNotNull(exception);\r
+               assertThat(exception.getMessage(), is("java.lang.Throwable: New Exception"));\r
+       }\r
+\r
+       @Test\r
+       public void testCadiExceptionStringThrowable() {\r
+               CadiException exception = new CadiException("New Exception",new Throwable("New Exception"));\r
+               assertNotNull(exception);\r
+               assertThat(exception.getMessage(), is("New Exception"));\r
+\r
+       }\r
+       \r
+       @Test\r
+       public void testCadiException1() {\r
+               CadiException exception = new CadiException();\r
+               \r
+               assertNotNull(exception);\r
+       }\r
+\r
+       @Test\r
+       public void testCadiExceptionString1() {\r
+               CadiException exception = new CadiException("New Exception");\r
+               assertNotNull(exception);\r
+               assertThat(exception.getMessage(), is("New Exception"));\r
+       }\r
+\r
+       @Test\r
+       public void testCadiExceptionThrowable1() {\r
+               CadiException exception = new CadiException(new Throwable("New Exception"));\r
+               assertNotNull(exception);\r
+               assertThat(exception.getMessage(), is("java.lang.Throwable: New Exception"));\r
+       }\r
+\r
+       @Test\r
+       public void testCadiExceptionStringThrowable1() {\r
+               CadiException exception = new CadiException("New Exception",new Throwable("New Exception"));\r
+               assertNotNull(exception);\r
+               assertThat(exception.getMessage(), is("New Exception"));\r
+\r
+       }\r
+       \r
+       @Test\r
+       public void testCadiException2() {\r
+               CadiException exception = new CadiException();\r
+               \r
+               assertNotNull(exception);\r
+       }\r
+\r
+       @Test\r
+       public void testCadiExceptionString2() {\r
+               CadiException exception = new CadiException("New Exception");\r
+               assertNotNull(exception);\r
+               assertThat(exception.getMessage(), is("New Exception"));\r
+       }\r
+\r
+       @Test\r
+       public void testCadiExceptionThrowable2() {\r
+               CadiException exception = new CadiException(new Throwable("New Exception"));\r
+               assertNotNull(exception);\r
+               assertThat(exception.getMessage(), is("java.lang.Throwable: New Exception"));\r
+       }\r
+\r
+       @Test\r
+       public void testCadiExceptionStringThrowable2() {\r
+               CadiException exception = new CadiException("New Exception",new Throwable("New Exception"));\r
+               assertNotNull(exception);\r
+               assertThat(exception.getMessage(), is("New Exception"));\r
+\r
+       }\r
+\r
+\r
+\r
+}\r