diff --git a/javatests/google/registry/export/BigqueryPollJobActionTest.java b/javatests/google/registry/export/BigqueryPollJobActionTest.java index 8f599166e..99eac5a4d 100644 --- a/javatests/google/registry/export/BigqueryPollJobActionTest.java +++ b/javatests/google/registry/export/BigqueryPollJobActionTest.java @@ -198,7 +198,6 @@ public class BigqueryPollJobActionTest { } @Test - @SuppressWarnings("unchecked") public void testJobStatusUnreadable() throws Exception { when(bigqueryJobsGet.execute()).thenThrow(IOException.class); thrown.expect(NotModifiedException.class); diff --git a/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java b/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java index e8de3384e..ddb8fe1e9 100644 --- a/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java +++ b/javatests/google/registry/flows/domain/DomainAllocateFlowTest.java @@ -419,13 +419,6 @@ public class DomainAllocateFlowTest doSuccessfulTest(13); } - @Test - @Override - public void testRequiresLogin() throws Exception { - createTld("tld"); - super.testRequiresLogin(); - } - @Test public void testSuccess_secDns() throws Exception { setupDomainApplication("tld", TldState.QUIET_PERIOD); diff --git a/javatests/google/registry/model/tmch/TmchCrlTest.java b/javatests/google/registry/model/tmch/TmchCrlTest.java index 9c5680c73..42860a688 100644 --- a/javatests/google/registry/model/tmch/TmchCrlTest.java +++ b/javatests/google/registry/model/tmch/TmchCrlTest.java @@ -29,7 +29,6 @@ public class TmchCrlTest { @Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build(); @Test - @SuppressWarnings("null") public void testSuccess() throws Exception { assertThat(TmchCrl.get()).isNull(); TmchCrl.set("lolcat", "http://lol.cat"); diff --git a/javatests/google/registry/rde/imports/RdeImportUtilsTest.java b/javatests/google/registry/rde/imports/RdeImportUtilsTest.java index 3f2d039f7..27203ebb0 100644 --- a/javatests/google/registry/rde/imports/RdeImportUtilsTest.java +++ b/javatests/google/registry/rde/imports/RdeImportUtilsTest.java @@ -297,7 +297,6 @@ public class RdeImportUtilsTest extends ShardableTestCase { /** Verifies that no errors are thrown when a valid escrow file is validated */ @Test - @SuppressWarnings("CheckReturnValue") public void testValidateEscrowFile_valid() throws Exception { xmlInput = DEPOSIT_XML.openBufferedStream(); when(gcsUtils.openInputStream(any(GcsFilename.class))).thenReturn(xmlInput); diff --git a/javatests/google/registry/util/ComparingInvocationHandlerTest.java b/javatests/google/registry/util/ComparingInvocationHandlerTest.java index 07b8e95d5..423c86037 100644 --- a/javatests/google/registry/util/ComparingInvocationHandlerTest.java +++ b/javatests/google/registry/util/ComparingInvocationHandlerTest.java @@ -31,11 +31,11 @@ import org.junit.runners.JUnit4; @RunWith(JUnit4.class) public class ComparingInvocationHandlerTest { - static class Dummy { - } + static class Dummy {} static interface MyInterface { String func(int a, String b); + Dummy func(); } @@ -52,13 +52,13 @@ public class ComparingInvocationHandlerTest { } static final ArrayList log = new ArrayList<>(); + static final class MyInterfaceComparingInvocationHandler extends ComparingInvocationHandler { private boolean dummyEqualsResult = true; private boolean exceptionEqualsResult = true; - MyInterfaceComparingInvocationHandler(MyInterface actual, MyInterface second) { super(MyInterface.class, actual, second); } @@ -73,30 +73,34 @@ public class ComparingInvocationHandlerTest { return this; } - @Override protected void log(Method method, String message) { + @Override + protected void log(Method method, String message) { log.add(String.format("%s: %s", method.getName(), message)); } - @Override protected boolean compareResults( - Method method, @Nullable Object a, @Nullable Object b) { + @Override + protected boolean compareResults(Method method, @Nullable Object a, @Nullable Object b) { if (method.getReturnType().equals(Dummy.class)) { return dummyEqualsResult; } return super.compareResults(method, a, b); } - @Override protected String stringifyResult(Method method, @Nullable Object a) { + @Override + protected String stringifyResult(Method method, @Nullable Object a) { if (method.getReturnType().equals(Dummy.class)) { return "dummy"; } return super.stringifyResult(method, a); } - @Override protected boolean compareThrown(Method method, Throwable a, Throwable b) { + @Override + protected boolean compareThrown(Method method, Throwable a, Throwable b) { return exceptionEqualsResult && super.compareThrown(method, a, b); } - @Override protected String stringifyThrown(Method method, Throwable a) { + @Override + protected String stringifyThrown(Method method, Throwable a) { return String.format("testException(%s)", super.stringifyThrown(method, a)); } } @@ -108,12 +112,14 @@ public class ComparingInvocationHandlerTest { private final MyInterface mySecondMock = mock(MyInterface.class); private MyInterfaceComparingInvocationHandler invocationHandler; - @Before public void setUp() { + @Before + public void setUp() { log.clear(); invocationHandler = new MyInterfaceComparingInvocationHandler(myActualMock, mySecondMock); } - @Test public void test_actualThrows_logDifference() { + @Test + public void test_actualThrows_logDifference() { MyInterface comparator = invocationHandler.makeProxy(); MyException myException = new MyException("message"); when(myActualMock.func(3, "str")).thenThrow(myException); @@ -125,12 +131,15 @@ public class ComparingInvocationHandlerTest { } catch (MyException expected) { } - assertThat(log).containsExactly(String.format( - "func: Only actual implementation threw exception: testException(%s)", - myException.toString())); + assertThat(log) + .containsExactly( + String.format( + "func: Only actual implementation threw exception: testException(%s)", + myException.toString())); } - @Test public void test_secondThrows_logDifference() { + @Test + public void test_secondThrows_logDifference() { MyInterface comparator = invocationHandler.makeProxy(); MyOtherException myOtherException = new MyOtherException("message"); when(myActualMock.func(3, "str")).thenReturn(ACTUAL_RESULT); @@ -138,15 +147,16 @@ public class ComparingInvocationHandlerTest { assertThat(comparator.func(3, "str")).isEqualTo(ACTUAL_RESULT); - assertThat(log).containsExactly(String.format( - "func: Only second implementation threw exception: testException(%s)", - myOtherException.toString())); + assertThat(log) + .containsExactly( + String.format( + "func: Only second implementation threw exception: testException(%s)", + myOtherException.toString())); } - @Test public void test_bothThrowEqual_noLog() { - MyInterface comparator = invocationHandler - .setExeptionsEquals(true) - .makeProxy(); + @Test + public void test_bothThrowEqual_noLog() { + MyInterface comparator = invocationHandler.setExeptionsEquals(true).makeProxy(); MyException myException = new MyException("actual message"); MyOtherException myOtherException = new MyOtherException("second message"); when(myActualMock.func(3, "str")).thenThrow(myException); @@ -161,10 +171,9 @@ public class ComparingInvocationHandlerTest { assertThat(log).isEmpty(); } - @Test public void test_bothThrowDifferent_logDifference() { - MyInterface comparator = invocationHandler - .setExeptionsEquals(false) - .makeProxy(); + @Test + public void test_bothThrowDifferent_logDifference() { + MyInterface comparator = invocationHandler.setExeptionsEquals(false).makeProxy(); MyException myException = new MyException("actual message"); MyOtherException myOtherException = new MyOtherException("second message"); when(myActualMock.func(3, "str")).thenThrow(myException); @@ -176,14 +185,16 @@ public class ComparingInvocationHandlerTest { } catch (MyException expected) { } - assertThat(log).containsExactly(String.format( - "func: Both implementations threw, but got different exceptions! " - + "'testException(%s)' vs 'testException(%s)'", - myException.toString(), - myOtherException.toString())); + assertThat(log) + .containsExactly( + String.format( + "func: Both implementations threw, but got different exceptions! " + + "'testException(%s)' vs 'testException(%s)'", + myException.toString(), myOtherException.toString())); } - @Test public void test_bothReturnSame_noLog() { + @Test + public void test_bothReturnSame_noLog() { MyInterface comparator = invocationHandler.makeProxy(); when(myActualMock.func(3, "str")).thenReturn(ACTUAL_RESULT); when(mySecondMock.func(3, "str")).thenReturn(ACTUAL_RESULT); @@ -193,23 +204,21 @@ public class ComparingInvocationHandlerTest { assertThat(log).isEmpty(); } - @Test public void test_bothReturnDifferent_logDifference() { + @Test + public void test_bothReturnDifferent_logDifference() { MyInterface comparator = invocationHandler.makeProxy(); when(myActualMock.func(3, "str")).thenReturn(ACTUAL_RESULT); when(mySecondMock.func(3, "str")).thenReturn(SECOND_RESULT); assertThat(comparator.func(3, "str")).isEqualTo(ACTUAL_RESULT); - assertThat(log).containsExactly( - "func: Got different results! " - + "'actual result' vs " - + "'second result'"); + assertThat(log) + .containsExactly("func: Got different results! 'actual result' vs 'second result'"); } - @Test public void test_usesOverriddenMethods_noDifference() { - MyInterface comparator = invocationHandler - .setDummyEquals(true) - .makeProxy(); + @Test + public void test_usesOverriddenMethods_noDifference() { + MyInterface comparator = invocationHandler.setDummyEquals(true).makeProxy(); when(myActualMock.func()).thenReturn(new Dummy()); when(mySecondMock.func()).thenReturn(new Dummy()); @@ -218,18 +227,14 @@ public class ComparingInvocationHandlerTest { assertThat(log).isEmpty(); } - @Test public void test_usesOverriddenMethods_logDifference() { - MyInterface comparator = invocationHandler - .setDummyEquals(false) - .makeProxy(); + @Test + public void test_usesOverriddenMethods_logDifference() { + MyInterface comparator = invocationHandler.setDummyEquals(false).makeProxy(); when(myActualMock.func()).thenReturn(new Dummy()); when(mySecondMock.func()).thenReturn(new Dummy()); comparator.func(); - assertThat(log).containsExactly( - "func: Got different results! " - + "'dummy' vs " - + "'dummy'"); + assertThat(log).containsExactly("func: Got different results! 'dummy' vs 'dummy'"); } }