1
0
mirror of https://github.com/google/nomulus synced 2026-01-08 07:11:44 +00:00

Correct containsMatch() -> contains() for non-regexes (#940)

* Correct containsMatch() -> contains() for non-regexes
This commit is contained in:
Ben McIlwain
2021-01-22 14:31:38 -05:00
committed by GitHub
parent 31ef402c50
commit 08cec96a93
4 changed files with 7 additions and 11 deletions

View File

@@ -919,7 +919,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
.addStatusValue(SERVER_UPDATE_PROHIBITED)
.build());
Exception e = assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(e).hasMessageThat().containsMatch("serverUpdateProhibited");
assertThat(e).hasMessageThat().contains("serverUpdateProhibited");
}
@Test
@@ -937,7 +937,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
persistReferencedEntities();
persistDomain();
Exception e = assertThrows(StatusNotClientSettableException.class, this::runFlow);
assertThat(e).hasMessageThat().containsMatch("serverUpdateProhibited");
assertThat(e).hasMessageThat().contains("serverUpdateProhibited");
}
@Test

View File

@@ -174,9 +174,7 @@ class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
void testFailure_noSuchMessage() throws Exception {
assertTransactionalFlow(true);
Exception e = assertThrows(MessageDoesNotExistException.class, this::runFlow);
assertThat(e)
.hasMessageThat()
.containsMatch(String.format("(1-3-EXAMPLE-4-%d-2011)", MESSAGE_ID));
assertThat(e).hasMessageThat().contains(String.format("(1-3-EXAMPLE-4-%d-2011)", MESSAGE_ID));
}
@Test
@@ -255,8 +253,6 @@ class PollAckFlowTest extends FlowTestCase<PollAckFlow> {
.build());
assertTransactionalFlow(true);
Exception e = assertThrows(MessageDoesNotExistException.class, this::runFlow);
assertThat(e)
.hasMessageThat()
.containsMatch(String.format("(1-3-EXAMPLE-4-%d-2011)", MESSAGE_ID));
assertThat(e).hasMessageThat().contains(String.format("(1-3-EXAMPLE-4-%d-2011)", MESSAGE_ID));
}
}

View File

@@ -53,7 +53,7 @@ class TmchCertificateAuthorityTest {
CertificateExpiredException e =
assertThrows(
CertificateExpiredException.class, tmchCertificateAuthority::getAndValidateRoot);
assertThat(e).hasMessageThat().containsMatch("NotAfter: Sun Jul 23 23:59:59 UTC 2023");
assertThat(e).hasMessageThat().contains("NotAfter: Sun Jul 23 23:59:59 UTC 2023");
}
@Test
@@ -64,7 +64,7 @@ class TmchCertificateAuthorityTest {
CertificateNotYetValidException e =
assertThrows(
CertificateNotYetValidException.class, tmchCertificateAuthority::getAndValidateRoot);
assertThat(e).hasMessageThat().containsMatch("NotBefore: Wed Jul 24 00:00:00 UTC 2013");
assertThat(e).hasMessageThat().contains("NotBefore: Wed Jul 24 00:00:00 UTC 2013");
}
@Test

View File

@@ -61,7 +61,7 @@ public class CompareDbBackupsTest {
URL backupRootFolder = Resources.getResource("google/registry/tools/datastore-export");
CompareDbBackups.main(new String[] {backupRootFolder.getPath(), backupRootFolder.getPath()});
String output = new String(stdout.toByteArray(), UTF_8);
assertThat(output).containsMatch("Both sets have the same 41 entities");
assertThat(output).contains("Both sets have the same 41 entities");
}
@Test