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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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) .addStatusValue(SERVER_UPDATE_PROHIBITED)
.build()); .build());
Exception e = assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow); Exception e = assertThrows(ResourceStatusProhibitsOperationException.class, this::runFlow);
assertThat(e).hasMessageThat().containsMatch("serverUpdateProhibited"); assertThat(e).hasMessageThat().contains("serverUpdateProhibited");
} }
@Test @Test
@ -937,7 +937,7 @@ class DomainUpdateFlowTest extends ResourceFlowTestCase<DomainUpdateFlow, Domain
persistReferencedEntities(); persistReferencedEntities();
persistDomain(); persistDomain();
Exception e = assertThrows(StatusNotClientSettableException.class, this::runFlow); Exception e = assertThrows(StatusNotClientSettableException.class, this::runFlow);
assertThat(e).hasMessageThat().containsMatch("serverUpdateProhibited"); assertThat(e).hasMessageThat().contains("serverUpdateProhibited");
} }
@Test @Test

View file

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

View file

@ -53,7 +53,7 @@ class TmchCertificateAuthorityTest {
CertificateExpiredException e = CertificateExpiredException e =
assertThrows( assertThrows(
CertificateExpiredException.class, tmchCertificateAuthority::getAndValidateRoot); 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 @Test
@ -64,7 +64,7 @@ class TmchCertificateAuthorityTest {
CertificateNotYetValidException e = CertificateNotYetValidException e =
assertThrows( assertThrows(
CertificateNotYetValidException.class, tmchCertificateAuthority::getAndValidateRoot); 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 @Test

View file

@ -61,7 +61,7 @@ public class CompareDbBackupsTest {
URL backupRootFolder = Resources.getResource("google/registry/tools/datastore-export"); URL backupRootFolder = Resources.getResource("google/registry/tools/datastore-export");
CompareDbBackups.main(new String[] {backupRootFolder.getPath(), backupRootFolder.getPath()}); CompareDbBackups.main(new String[] {backupRootFolder.getPath(), backupRootFolder.getPath()});
String output = new String(stdout.toByteArray(), UTF_8); 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 @Test