Fix more deprecated methods in truth tests

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135481064
This commit is contained in:
cgoldfeder 2016-10-07 08:58:58 -07:00 committed by Ben McIlwain
parent a09d48a4a5
commit fabbf8871c
2 changed files with 8 additions and 8 deletions

View file

@ -47,11 +47,11 @@ abstract class AbstractEppResourceSubject
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected And<S> andChainer() { protected And<S> andChainer() {
return new And<S>((S) this); return new And<>((S) this);
} }
@Override @Override
public String getDisplaySubject() { public String actualCustomStringRepresentation() {
return String.format( return String.format(
"%s with foreign key '%s'", "%s with foreign key '%s'",
actual().getClass().getSimpleName(), actual().getClass().getSimpleName(),
@ -115,7 +115,7 @@ abstract class AbstractEppResourceSubject
failWithBadResults( failWithBadResults(
"has at least number of history entries", index + 1, historyEntries.size()); "has at least number of history entries", index + 1, historyEntries.size());
} }
return new Which<HistoryEntrySubject>(assertAboutHistoryEntries() return new Which<>(assertAboutHistoryEntries()
.that(getHistoryEntries().get(index)).withCustomDisplaySubject(String.format( .that(getHistoryEntries().get(index)).withCustomDisplaySubject(String.format(
"the history entry for %s at index %s", getDisplaySubject(), index))); "the history entry for %s at index %s", getDisplaySubject(), index)));
} }

View file

@ -39,7 +39,7 @@ public class HistoryEntrySubject extends Subject<HistoryEntrySubject, HistoryEnt
} }
@Override @Override
public String getDisplaySubject() { public String actualCustomStringRepresentation() {
return Optional.fromNullable(customDisplaySubject).or(super.actualAsString()); return Optional.fromNullable(customDisplaySubject).or(super.actualAsString());
} }
@ -60,7 +60,7 @@ public class HistoryEntrySubject extends Subject<HistoryEntrySubject, HistoryEnt
if (actual().getPeriod() == null) { if (actual().getPeriod() == null) {
fail("has a period"); fail("has a period");
} }
return new And<HistoryEntrySubject>(this); return new And<>(this);
} }
public And<HistoryEntrySubject> hasPeriodYears(int years) { public And<HistoryEntrySubject> hasPeriodYears(int years) {
@ -73,7 +73,7 @@ public class HistoryEntrySubject extends Subject<HistoryEntrySubject, HistoryEnt
if (actual().getXmlBytes() != null) { if (actual().getXmlBytes() != null) {
fail("has no xml"); fail("has no xml");
} }
return new And<HistoryEntrySubject>(this); return new And<>(this);
} }
public And<HistoryEntrySubject> hasMetadataReason(String reason) { public And<HistoryEntrySubject> hasMetadataReason(String reason) {
@ -85,7 +85,7 @@ public class HistoryEntrySubject extends Subject<HistoryEntrySubject, HistoryEnt
if (actual().getRequestedByRegistrar() != requestedByRegistrar) { if (actual().getRequestedByRegistrar() != requestedByRegistrar) {
fail("has metadata requestedByRegistrar with value", requestedByRegistrar); fail("has metadata requestedByRegistrar with value", requestedByRegistrar);
} }
return new And<HistoryEntrySubject>(this); return new And<>(this);
} }
protected void failWithBadResults(String dualVerb, Object expected, Object actual) { protected void failWithBadResults(String dualVerb, Object expected, Object actual) {
@ -96,7 +96,7 @@ public class HistoryEntrySubject extends Subject<HistoryEntrySubject, HistoryEnt
if (!Objects.equals(expected, actual)) { if (!Objects.equals(expected, actual)) {
failWithBadResults(verb, expected, actual); failWithBadResults(verb, expected, actual);
} }
return new And<HistoryEntrySubject>(this); return new And<>(this);
} }
public static DelegatedVerb<HistoryEntrySubject, HistoryEntry> assertAboutHistoryEntries() { public static DelegatedVerb<HistoryEntrySubject, HistoryEntry> assertAboutHistoryEntries() {