Standardize test methods to be prefixed with "test"

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131176866
This commit is contained in:
mcilwain 2016-08-24 08:51:24 -07:00 committed by Ben McIlwain
parent 52bb8a5773
commit 8f0f701ff7
9 changed files with 43 additions and 46 deletions

View file

@ -81,7 +81,7 @@ public class DnsMessageTransportTest {
}
@Test
public void sentMessageHasCorrectLengthAndContent() throws Exception {
public void testSentMessageHasCorrectLengthAndContent() throws Exception {
ByteArrayInputStream inputStream =
new ByteArrayInputStream(messageToBytesWithLength(expectedResponse));
when(mockSocket.getInputStream()).thenReturn(inputStream);
@ -99,7 +99,7 @@ public class DnsMessageTransportTest {
}
@Test
public void receivedMessageWithLengthHasCorrectContent() throws Exception {
public void testReceivedMessageWithLengthHasCorrectContent() throws Exception {
ByteArrayInputStream inputStream =
new ByteArrayInputStream(messageToBytesWithLength(expectedResponse));
when(mockSocket.getInputStream()).thenReturn(inputStream);
@ -112,7 +112,7 @@ public class DnsMessageTransportTest {
}
@Test
public void eofReceivingResponse() throws Exception {
public void testEofReceivingResponse() throws Exception {
byte[] messageBytes = messageToBytesWithLength(expectedResponse);
ByteArrayInputStream inputStream =
new ByteArrayInputStream(Arrays.copyOf(messageBytes, messageBytes.length - 1));
@ -125,7 +125,7 @@ public class DnsMessageTransportTest {
}
@Test
public void timeoutReceivingResponse() throws Exception {
public void testTimeoutReceivingResponse() throws Exception {
InputStream mockInputStream = mock(InputStream.class);
when(mockInputStream.read()).thenThrow(new SocketTimeoutException("testing"));
when(mockSocket.getInputStream()).thenReturn(mockInputStream);
@ -143,7 +143,7 @@ public class DnsMessageTransportTest {
}
@Test
public void sentMessageTooLongThrowsException() throws Exception {
public void testSentMessageTooLongThrowsException() throws Exception {
Update oversize = new Update(Name.fromString("tld", Name.root));
for (int i = 0; i < 2000; i++) {
oversize.add(
@ -160,7 +160,7 @@ public class DnsMessageTransportTest {
}
@Test
public void responseIdMismatchThrowsExeption() throws Exception {
public void testResponseIdMismatchThrowsExeption() throws Exception {
expectedResponse.getHeader().setID(1 + simpleQuery.getHeader().getID());
when(mockSocket.getInputStream())
.thenReturn(new ByteArrayInputStream(messageToBytesWithLength(expectedResponse)));
@ -176,7 +176,7 @@ public class DnsMessageTransportTest {
}
@Test
public void responseOpcodeMismatchThrowsException() throws Exception {
public void testResponseOpcodeMismatchThrowsException() throws Exception {
simpleQuery.getHeader().setOpcode(Opcode.QUERY);
expectedResponse.getHeader().setOpcode(Opcode.STATUS);
when(mockSocket.getInputStream())

View file

@ -101,7 +101,7 @@ public class DnsUpdateWriterTest {
}
@Test
public void publishDomainCreatePublishesNameServers() throws Exception {
public void testPublishDomainCreate_publishesNameServers() throws Exception {
HostResource host1 = persistActiveHost("ns1.example.tld");
HostResource host2 = persistActiveHost("ns2.example.tld");
DomainResource domain =
@ -122,7 +122,7 @@ public class DnsUpdateWriterTest {
}
@Test
public void publishDomainCreatePublishesDelegationSigner() throws Exception {
public void testPublishDomainCreate_publishesDelegationSigner() throws Exception {
DomainResource domain =
persistActiveDomain("example.tld")
.asBuilder()
@ -145,7 +145,7 @@ public class DnsUpdateWriterTest {
}
@Test
public void publishDomainWhenNotActiveRemovesDnsRecords() throws Exception {
public void testPublishDomainWhenNotActive_removesDnsRecords() throws Exception {
DomainResource domain =
persistActiveDomain("example.tld")
.asBuilder()
@ -164,7 +164,7 @@ public class DnsUpdateWriterTest {
}
@Test
public void publishDomainDeleteRemovesDnsRecords() throws Exception {
public void testPublishDomainDelete_removesDnsRecords() throws Exception {
persistDeletedDomain("example.tld", clock.nowUtc());
writer.publishDomain("example.tld");
@ -177,7 +177,7 @@ public class DnsUpdateWriterTest {
}
@Test
public void publishHostCreatePublishesAddressRecords() throws Exception {
public void testPublishHostCreate_publishesAddressRecords() throws Exception {
HostResource host =
persistResource(
newHostResource("ns1.example.tld")
@ -209,7 +209,7 @@ public class DnsUpdateWriterTest {
}
@Test
public void publishHostDeleteRemovesDnsRecords() throws Exception {
public void testPublishHostDelete_removesDnsRecords() throws Exception {
persistDeletedHost("ns1.example.tld", clock.nowUtc());
persistActiveDomain("example.tld");
@ -224,7 +224,7 @@ public class DnsUpdateWriterTest {
}
@Test
public void publishHostDeleteRemovesGlueRecords() throws Exception {
public void testPublishHostDelete_removesGlueRecords() throws Exception {
persistDeletedHost("ns1.example.tld", clock.nowUtc());
persistResource(
persistActiveDomain("example.tld")
@ -244,7 +244,7 @@ public class DnsUpdateWriterTest {
}
@Test
public void publishDomainExternalAndInBailiwickNameServer() throws Exception {
public void testPublishDomainExternalAndInBailiwickNameServer() throws Exception {
HostResource externalNameserver = persistResource(newHostResource("ns1.example.com"));
HostResource inBailiwickNameserver =
persistResource(
@ -279,7 +279,7 @@ public class DnsUpdateWriterTest {
}
@Test
public void publishDomainDeleteOrphanGlues() throws Exception {
public void testPublishDomainDeleteOrphanGlues() throws Exception {
HostResource inBailiwickNameserver =
persistResource(
newHostResource("ns1.example.tld")
@ -314,7 +314,7 @@ public class DnsUpdateWriterTest {
}
@Test
public void publishDomainFailsWhenDnsUpdateReturnsError() throws Exception {
public void testPublishDomainFails_whenDnsUpdateReturnsError() throws Exception {
DomainResource domain =
persistActiveDomain("example.tld")
.asBuilder()
@ -328,7 +328,7 @@ public class DnsUpdateWriterTest {
}
@Test
public void publishHostFailsWhenDnsUpdateReturnsError() throws Exception {
public void testPublishHostFails_whenDnsUpdateReturnsError() throws Exception {
HostResource host =
persistActiveSubordinateHost("ns1.example.tld", persistActiveDomain("example.tld"))
.asBuilder()

View file

@ -43,7 +43,7 @@ public class EppConsoleActionTest extends ShardableTestCase {
.build();
@Test
public void doTest() {
public void testAction() {
EppConsoleAction action = new EppConsoleAction();
action.inputXmlBytes = INPUT_XML_BYTES;
action.session = new FakeHttpSession();

View file

@ -26,14 +26,11 @@ import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class TmchCrlTest {
@Rule
public final AppEngineRule appEngine = AppEngineRule.builder()
.withDatastore()
.build();
@Rule public final AppEngineRule appEngine = AppEngineRule.builder().withDatastore().build();
@Test
@SuppressWarnings("null")
public void success() throws Exception {
public void testSuccess() throws Exception {
assertThat(TmchCrl.get()).isNull();
TmchCrl.set("lolcat");
assertThat(TmchCrl.get().getCrl()).isEqualTo("lolcat");

View file

@ -49,7 +49,7 @@ public class LordnLogTest {
"1580e26-roid,3610");
@Test
public void successParseFirstLine() throws Exception {
public void testSuccess_parseFirstLine() throws Exception {
LordnLog log = LordnLog.parse(EXAMPLE_FROM_RFC);
assertThat(log.getStatus()).isEqualTo(LordnLog.Status.ACCEPTED);
assertThat(log.getLogCreation()).isEqualTo(DateTime.parse("2012-08-16T02:15:00.0Z"));
@ -60,7 +60,7 @@ public class LordnLogTest {
}
@Test
public void successParseDnLines() throws Exception {
public void testSuccess_parseDnLines() throws Exception {
LordnLog log = LordnLog.parse(EXAMPLE_FROM_RFC);
Result result = log.getResult("SH8013-REP");
assertThat(result).isNotNull();
@ -70,7 +70,7 @@ public class LordnLogTest {
}
@Test
public void successIterate() throws Exception {
public void testSuccess_iterate() throws Exception {
for (Entry<String, Result> result : LordnLog.parse(EXAMPLE_FROM_RFC)) {
assertThat(result.getKey()).isEqualTo("SH8013-REP");
assertThat(result.getValue().getCode()).isEqualTo(2000);
@ -80,14 +80,14 @@ public class LordnLogTest {
}
@Test
public void successNoDnLines() throws Exception {
public void testSuccess_noDnLines() throws Exception {
LordnLog.parse(ImmutableList.of(
"1,2012-08-16T02:15:00.0Z,2012-08-16T00:00:00.0Z,lolcat,accepted,no-warnings,0",
"roid,result-code"));
}
@Test
public void failureNoDnLineMismatch() throws Exception {
public void testFailure_noDnLineMismatch() throws Exception {
thrown.expect(IllegalArgumentException.class);
LordnLog.parse(ImmutableList.of(
"1,2012-08-16T02:15:00.0Z,2012-08-16T00:00:00.0Z,lolcat,accepted,no-warnings,1",
@ -95,26 +95,26 @@ public class LordnLogTest {
}
@Test
public void failureParseNull() throws Exception {
public void testFailure_parseNull() throws Exception {
thrown.expect(NullPointerException.class);
LordnLog.parse(null);
}
@Test
public void failureParseEmpty() throws Exception {
public void testFailure_parseEmpty() throws Exception {
thrown.expect(Exception.class);
LordnLog.parse(ImmutableList.<String>of());
}
@Test
public void failureParseMissingHeaderLine() throws Exception {
public void testFailure_parseMissingHeaderLine() throws Exception {
thrown.expect(Exception.class);
LordnLog.parse(ImmutableList.of(
"1,2012-08-16T02:15:00.0Z,2012-08-16T00:00:00.0Z,lolcat,accepted,no-warnings,0"));
}
@Test
public void successToString() throws Exception {
public void testSuccess_toString() throws Exception {
assertThat(LordnLog.parse(EXAMPLE_WITH_WARNINGS).toString()).isEqualTo(
"LordnLog{"
+ "logId=0000000000000004799, "
@ -131,14 +131,14 @@ public class LordnLogTest {
}
@Test
public void successResultToString() throws Exception {
public void testSuccess_resultToString() throws Exception {
assertThat(
LordnLog.parse(EXAMPLE_FROM_RFC).iterator().next().toString())
.isEqualTo("SH8013-REP=Result{code=2000, outcome=OK, description=OK}");
}
@Test
public void successWithWarnings() throws Exception {
public void testSuccess_withWarnings() throws Exception {
LordnLog log = LordnLog.parse(EXAMPLE_WITH_WARNINGS);
assertThat(log.getStatus()).isEqualTo(LordnLog.Status.ACCEPTED);
assertThat(log.getLogCreation()).isEqualTo(DateTime.parse("2014-03-21T15:40:08.4Z"));

View file

@ -38,7 +38,7 @@ public class TmchSmdrlActionTest extends TmchActionTestCase {
}
@Test
public void successSmdrl() throws Exception {
public void testSuccess_smdrl() throws Exception {
SignedMarkRevocationList smdrl = SignedMarkRevocationList.get();
assertThat(smdrl.isSmdRevoked("0000001681375789102250-65535", now)).isFalse();
assertThat(smdrl.isSmdRevoked("0000001681375789102250-65536", now)).isFalse();

View file

@ -50,13 +50,13 @@ public class DurationParameterTest {
}
@Test
public void demonstrateThat_isoMissingP_notAllowed() throws Exception {
public void testIsoMissingP_notAllowed() throws Exception {
thrown.expect(IllegalArgumentException.class);
Period.parse("T36H");
}
@Test
public void demonstrateThat_isoMissingPT_notAllowed() throws Exception {
public void testIsoMissingPT_notAllowed() throws Exception {
thrown.expect(IllegalArgumentException.class);
Period.parse("36H");
}

View file

@ -59,39 +59,39 @@ public class ConsoleUiActionTest {
}
@Test
public void webPage_disallowsIframe() throws Exception {
public void testWebPage_disallowsIframe() throws Exception {
action.run();
assertThat(response.getHeaders()).containsEntry("X-Frame-Options", "SAMEORIGIN");
}
@Test
public void webPage_setsHtmlUtf8ContentType() throws Exception {
public void testWebPage_setsHtmlUtf8ContentType() throws Exception {
action.run();
assertThat(response.getContentType()).isEqualTo(MediaType.HTML_UTF_8);
}
@Test
public void webPage_containsUserNickname() throws Exception {
public void testWebPage_containsUserNickname() throws Exception {
action.run();
assertThat(response.getPayload()).contains("marla.singer");
}
@Test
public void userHasAccessAsTheRegistrar_showsRegistrarConsole() throws Exception {
public void testUserHasAccessAsTheRegistrar_showsRegistrarConsole() throws Exception {
action.run();
assertThat(response.getPayload()).contains("Registrar Console");
assertThat(response.getPayload()).contains("reg-content-and-footer");
}
@Test
public void consoleDisabled_showsDisabledPage() throws Exception {
public void testConsoleDisabled_showsDisabledPage() throws Exception {
action.enabled = false;
action.run();
assertThat(response.getPayload()).contains("<h1>Console is disabled</h1>");
}
@Test
public void userDoesntHaveAccessToAnyRegistrar_showsWhoAreYouPage() throws Exception {
public void testUserDoesntHaveAccessToAnyRegistrar_showsWhoAreYouPage() throws Exception {
when(sessionUtils.checkRegistrarConsoleLogin(any(HttpServletRequest.class))).thenReturn(false);
action.run();
assertThat(response.getPayload()).contains("<h1>You need permission</h1>");

View file

@ -78,7 +78,7 @@ public class NameserverWhoisResponseTest {
}
@Test
public void getTextOutputTest() {
public void testGetTextOutput() {
NameserverWhoisResponse nameserverWhoisResponse =
new NameserverWhoisResponse(hostResource1, clock.nowUtc());
assertThat(nameserverWhoisResponse.getPlainTextOutput(false, "Doodle Disclaimer"))
@ -86,7 +86,7 @@ public class NameserverWhoisResponseTest {
}
@Test
public void getMultipleNameserversResponse() {
public void testGetMultipleNameserversResponse() {
NameserverWhoisResponse nameserverWhoisResponse =
new NameserverWhoisResponse(ImmutableList.of(hostResource1, hostResource2), clock.nowUtc());
assertThat(nameserverWhoisResponse.getPlainTextOutput(false, "Doodle Disclaimer"))