X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=common%2Ftestutils%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Ftestutils%2Fmockito%2Ftests%2FMockitoUnstubbedMethodExceptionAnswerTest.java;h=5dd9bff9cf6740675c92d93bdf6015f34d578caa;hb=80197ad7e563032a0243f4df9d178909c6f79610;hp=2b1296f663cbac3f4dcec7c0af817314df2abe98;hpb=973291f2cbf36233db82096856131ec63ee1728e;p=yangtools.git diff --git a/common/testutils/src/test/java/org/opendaylight/yangtools/testutils/mockito/tests/MockitoUnstubbedMethodExceptionAnswerTest.java b/common/testutils/src/test/java/org/opendaylight/yangtools/testutils/mockito/tests/MockitoUnstubbedMethodExceptionAnswerTest.java index 2b1296f663..5dd9bff9cf 100644 --- a/common/testutils/src/test/java/org/opendaylight/yangtools/testutils/mockito/tests/MockitoUnstubbedMethodExceptionAnswerTest.java +++ b/common/testutils/src/test/java/org/opendaylight/yangtools/testutils/mockito/tests/MockitoUnstubbedMethodExceptionAnswerTest.java @@ -7,8 +7,8 @@ */ package org.opendaylight.yangtools.testutils.mockito.tests; -import static com.google.common.truth.Truth.assertThat; -import static org.junit.Assert.fail; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; import static org.opendaylight.yangtools.testutils.mockito.MoreAnswers.exception; import java.io.Closeable; @@ -18,17 +18,10 @@ import org.mockito.Mockito; import org.opendaylight.yangtools.testutils.mockito.UnstubbedMethodException; public class MockitoUnstubbedMethodExceptionAnswerTest { - @Test public void testAnswering() throws IOException { Closeable mock = Mockito.mock(Closeable.class, exception()); - try { - mock.close(); - fail(); - } catch (UnstubbedMethodException e) { - assertThat(e.getMessage()).isEqualTo("close() is not stubbed in mock of java.io.Closeable"); - } - + String message = assertThrows(UnstubbedMethodException.class, mock::close).getMessage(); + assertEquals("close() is not stubbed in mock of java.io.Closeable", message); } - }