Modernize testutils tests
[yangtools.git] / common / testutils / src / test / java / org / opendaylight / yangtools / testutils / mockito / tests / MikitoTest.java
index 346dd3c1d4abcb320147690ce45a18ba46e39287..105a1b026c7023c565bd2cbd32c01e0ddd953bae 100644 (file)
@@ -7,9 +7,8 @@
  */
 package org.opendaylight.yangtools.testutils.mockito.tests;
 
-import static com.google.common.truth.Truth.assertThat;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.assertThrows;
 import static org.mockito.Mockito.mock;
 import static org.opendaylight.yangtools.testutils.mockito.MoreAnswers.realOrException;
 
@@ -48,12 +47,8 @@ public class MikitoTest {
     @Test
     public void usingMikitoToCallUnstubbedMethodAndExpectException() {
         MockSomeService service = mock(MockSomeService.class, realOrException());
-        try {
-            service.foo();
-            fail();
-        } catch (UnstubbedMethodException e) {
-            assertThat(e.getMessage()).isEqualTo("foo() is not implemented in mockSomeService");
-        }
+        String message = assertThrows(UnstubbedMethodException.class, service::foo).getMessage();
+        assertEquals("foo() is not implemented in mockSomeService", message);
     }
 
     abstract static class MockSomeService implements SomeService {