mirror of
https://github.com/google/nomulus
synced 2026-08-17 20:56:10 +00:00
Migrate from assertThat(foo).named("foo") to assertWithMessage("foo").that(foo).
(The exact change is slightly different in some cases, like when using custom subjects or check(), but it's always a migration from named(...) to [assert]WithMessage(...).)
named(...) is being removed.
This CL may slightly modify the failure messages produced, but all the old information will still be present.
More information:
[]
Tested:
TAP --sample for global presubmit queue
[]
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=245762634
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
package google.registry.testing;
|
||||
|
||||
import static com.google.common.truth.Truth.assertAbout;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.truth.Truth.assertWithMessage;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.testing.TestLogHandler;
|
||||
@@ -76,8 +76,9 @@ public class LogsSubject extends Subject<LogsSubject, TestLogHandler> {
|
||||
.contains(message);
|
||||
for (String messageCandidate : messagesAtLevel) {
|
||||
if (messageCandidate.contains(message)) {
|
||||
return new Which<>(assertThat(messageCandidate)
|
||||
.named(String.format("log message at %s matching '%s'", level, message)));
|
||||
return new Which<>(
|
||||
assertWithMessage(String.format("log message at %s matching '%s'", level, message))
|
||||
.that(messageCandidate));
|
||||
}
|
||||
}
|
||||
throw new AssertionError("Message check passed yet matching message not found");
|
||||
|
||||
Reference in New Issue
Block a user