Instead of calling Subject.actual(), store the actual value in a field, and read that.

actual() is being removed.

More information:
  []

Tested:
    TAP --sample ran all affected tests and none failed
    []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=247415370
This commit is contained in:
cpovirk 2019-05-09 06:47:46 -07:00 committed by jianglai
parent 38e2175699
commit 5bb93e9e4a
9 changed files with 107 additions and 119 deletions

View file

@ -33,8 +33,11 @@ import java.util.logging.LogRecord;
/** Utility methods for asserting things about logging {@link Handler} instances. */
public class LogsSubject extends Subject<LogsSubject, TestLogHandler> {
private final TestLogHandler actual;
public LogsSubject(FailureMetadata failureMetadata, TestLogHandler subject) {
super(failureMetadata, subject);
this.actual = subject;
}
private static final Correspondence<String, String> CONTAINS_CORRESPONDENCE =
@ -52,7 +55,7 @@ public class LogsSubject extends Subject<LogsSubject, TestLogHandler> {
private List<String> getMessagesAtLevel(Level level) {
ImmutableList.Builder<String> builder = new ImmutableList.Builder<>();
for (LogRecord log : actual().getStoredLogRecords()) {
for (LogRecord log : actual.getStoredLogRecords()) {
if (log.getLevel().equals(level)) {
builder.add(log.getMessage());
}