From 82bc8f543e578f32201d07a23b42d8539b89a4f1 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Mon, 5 Feb 2018 12:05:26 -0500 Subject: Add utils-test project Added utils-test project to policy/common. Modified integrity-audit and integrity-monitor to use the new utils-test project to test the Exception subclasses. Change-Id: If4a27cdb2351b7c49b084dbf287950172fa059cf Issue-ID: POLICY-582 Signed-off-by: Jim Hahn --- .../policy/common/ia/DbAuditExceptionTest.java | 41 ---------------- .../common/ia/DbDaoTransactionExceptionTest.java | 41 ---------------- .../common/ia/IntegrityAuditExceptionTest.java | 41 ---------------- .../ia/IntegrityAuditPropertiesExceptionTest.java | 41 ---------------- .../onap/policy/common/ia/test/ExceptionsTest.java | 56 ++++++++++++++++++++++ 5 files changed, 56 insertions(+), 164 deletions(-) delete mode 100644 integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditExceptionTest.java delete mode 100644 integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTransactionExceptionTest.java delete mode 100644 integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditExceptionTest.java delete mode 100644 integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditPropertiesExceptionTest.java create mode 100644 integrity-audit/src/test/java/org/onap/policy/common/ia/test/ExceptionsTest.java (limited to 'integrity-audit/src/test') diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditExceptionTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditExceptionTest.java deleted file mode 100644 index 005a9f15..00000000 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbAuditExceptionTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Integrity Audit - * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.policy.common.ia; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class DbAuditExceptionTest { - - @Test - public void test() { - DbAuditException e = new DbAuditException(); - assertNull(e.getMessage()); - e = new DbAuditException(""); - assertNotNull(e.getMessage()); - e = new DbAuditException(new Throwable()); - assertNotNull(e.getCause()); - e = new DbAuditException("", new Throwable()); - assertNotNull(e.getMessage()); - assertNotNull(e.getCause()); - } - -} diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTransactionExceptionTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTransactionExceptionTest.java deleted file mode 100644 index d93576e0..00000000 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/DbDaoTransactionExceptionTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Integrity Audit - * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.policy.common.ia; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class DbDaoTransactionExceptionTest { - - @Test - public void test() { - DbDaoTransactionException e = new DbDaoTransactionException(); - assertNull(e.getMessage()); - e = new DbDaoTransactionException(""); - assertNotNull(e.getMessage()); - e = new DbDaoTransactionException(new Throwable()); - assertNotNull(e.getCause()); - e = new DbDaoTransactionException("", new Throwable()); - assertNotNull(e.getMessage()); - assertNotNull(e.getCause()); - } - -} diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditExceptionTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditExceptionTest.java deleted file mode 100644 index b39e3986..00000000 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditExceptionTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Integrity Audit - * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.policy.common.ia; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class IntegrityAuditExceptionTest { - - @Test - public void test() { - IntegrityAuditException e = new IntegrityAuditException(); - assertNull(e.getMessage()); - e = new IntegrityAuditException(""); - assertNotNull(e.getMessage()); - e = new IntegrityAuditException(new Throwable()); - assertNotNull(e.getCause()); - e = new IntegrityAuditException("", new Throwable()); - assertNotNull(e.getMessage()); - assertNotNull(e.getCause()); - } - -} diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditPropertiesExceptionTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditPropertiesExceptionTest.java deleted file mode 100644 index 9c2b1196..00000000 --- a/integrity-audit/src/test/java/org/onap/policy/common/ia/IntegrityAuditPropertiesExceptionTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Integrity Audit - * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.policy.common.ia; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class IntegrityAuditPropertiesExceptionTest { - - @Test - public void test() { - IntegrityAuditPropertiesException e = new IntegrityAuditPropertiesException(); - assertNull(e.getMessage()); - e = new IntegrityAuditPropertiesException(""); - assertNotNull(e.getMessage()); - e = new IntegrityAuditPropertiesException(new Throwable()); - assertNotNull(e.getCause()); - e = new IntegrityAuditPropertiesException("", new Throwable()); - assertNotNull(e.getMessage()); - assertNotNull(e.getCause()); - } - -} diff --git a/integrity-audit/src/test/java/org/onap/policy/common/ia/test/ExceptionsTest.java b/integrity-audit/src/test/java/org/onap/policy/common/ia/test/ExceptionsTest.java new file mode 100644 index 00000000..af4a8ceb --- /dev/null +++ b/integrity-audit/src/test/java/org/onap/policy/common/ia/test/ExceptionsTest.java @@ -0,0 +1,56 @@ +/* + * ============LICENSE_START======================================================= + * Integrity Monitor + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.common.ia.test; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.policy.common.ia.DbAuditException; +import org.onap.policy.common.ia.DbDaoTransactionException; +import org.onap.policy.common.ia.IntegrityAuditException; +import org.onap.policy.common.ia.IntegrityAuditPropertiesException; +import org.onap.policy.common.utils.test.ExceptionsTester; + +/** + * Tests various Exception subclasses. + */ +public class ExceptionsTest extends ExceptionsTester { + + @Test + public void testDbAuditException() throws Exception { + assertEquals(4, test(DbAuditException.class)); + } + + @Test + public void testDbDaoTransactionException() throws Exception { + assertEquals(4, test(DbDaoTransactionException.class)); + } + + @Test + public void testIntegrityAuditException() throws Exception { + assertEquals(4, test(IntegrityAuditException.class)); + } + + @Test + public void testIntegrityAuditPropertiesException() throws Exception { + assertEquals(4, test(IntegrityAuditPropertiesException.class)); + } +} -- cgit 1.2.3-korg