diff --git a/src/test/java/com/google/acai/DependenciesTest.java b/src/test/java/com/google/acai/DependenciesTest.java index c26942e..6c44901 100644 --- a/src/test/java/com/google/acai/DependenciesTest.java +++ b/src/test/java/com/google/acai/DependenciesTest.java @@ -38,8 +38,7 @@ private static class ServiceB implements TestingService {} @Test public void arbitraryOrdering() { - Set testingServices = - ImmutableSet.of(new ServiceA(), new ServiceB(), new ServiceA()); + Set testingServices = ImmutableSet.of(new ServiceA(), new ServiceB()); assertThat(Dependencies.inOrder(testingServices)).containsExactlyElementsIn(testingServices); } diff --git a/src/test/java/com/google/acai/GuiceberryCompatibilityModuleTest.java b/src/test/java/com/google/acai/GuiceberryCompatibilityModuleTest.java index 1748ab7..9b99cc4 100644 --- a/src/test/java/com/google/acai/GuiceberryCompatibilityModuleTest.java +++ b/src/test/java/com/google/acai/GuiceberryCompatibilityModuleTest.java @@ -18,6 +18,7 @@ import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertWithMessage; +import static org.junit.Assert.assertThrows; import com.google.guiceberry.GuiceBerryEnvMain; import com.google.guiceberry.GuiceBerryModule; @@ -128,24 +129,23 @@ public void evaluate() { } @Test - public void testWrapperExceptionPropagated() throws Throwable { + public void testWrapperExceptionPropagated() { FakeTestClass test = new FakeTestClass(); - try { - new Acai(ThrowingWrapperModule.class) - .apply( - new Statement() { - @Override - public void evaluate() { - assertWithMessage("Test should not run when TestWrapper throws").fail(); - } - }, - frameworkMethod, - test) - .evaluate(); - assertWithMessage("Exception from TestWrapper should be propagated").fail(); - } catch (TestException expected) { - } + assertThrows( + TestException.class, + () -> + new Acai(ThrowingWrapperModule.class) + .apply( + new Statement() { + @Override + public void evaluate() { + assertWithMessage("Test should not run when TestWrapper throws").fail(); + } + }, + frameworkMethod, + test) + .evaluate()); } private static class FakeTestClass {