diff options
Diffstat (limited to 'controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ControlLoopPublisherTest.java')
-rw-r--r-- | controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ControlLoopPublisherTest.java | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ControlLoopPublisherTest.java b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ControlLoopPublisherTest.java index 77a3d643f..42b721ec1 100644 --- a/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ControlLoopPublisherTest.java +++ b/controlloop/common/eventmanager/src/test/java/org/onap/policy/controlloop/ControlLoopPublisherTest.java @@ -8,9 +8,9 @@ * 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. @@ -21,9 +21,8 @@ package org.onap.policy.controlloop; -import static org.junit.Assert.assertEquals; +import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; import org.junit.Test; import org.onap.policy.controlloop.impl.ControlLoopPublisherJUnitImpl; @@ -35,19 +34,11 @@ public class ControlLoopPublisherTest { new ControlLoopPublisher.Factory().buildLogger(ControlLoopPublisherJUnitImpl.class.getName()); assertNotNull(publisher); - try { - publisher.publish(Double.valueOf(3)); - fail("test should throw an exception here"); - } catch (Exception e) { - assertEquals("publish() method is not implemented on " - + "org.onap.policy.controlloop.impl.ControlLoopPublisherJUnitImpl", e.getMessage()); - } + assertThatThrownBy(() -> publisher.publish(Double.valueOf(3))) + .hasMessage("publish() method is not implemented on " + + "org.onap.policy.controlloop.impl.ControlLoopPublisherJUnitImpl"); - try { - new ControlLoopPublisher.Factory().buildLogger("java.lang.String"); - fail("test should throw an exception here"); - } catch (Exception e) { - assertEquals("Cannot load class java.lang.String as a control loop publisher", e.getMessage()); - } + assertThatThrownBy(() -> new ControlLoopPublisher.Factory().buildLogger("java.lang.String")) + .hasMessage("Cannot load class java.lang.String as a control loop publisher"); } } |