Upgrade Truth to 0.42
The 'fail' method is deprecated. Replace it as necessary. The new version includes a dependency on diffutils; add it. Change-Id: I80527c9ea41eb752710bed64cdb1621d4216ee46
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
package com.google.gerrit.truth;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.truth.Fact.fact;
|
||||
import static com.google.common.truth.Truth.assertAbout;
|
||||
|
||||
import com.google.common.truth.FailureMetadata;
|
||||
@@ -46,7 +47,7 @@ public class ListSubject<S extends Subject<S, E>, E> extends IterableSubject {
|
||||
isNotNull();
|
||||
List<E> list = getActualList();
|
||||
if (index >= list.size()) {
|
||||
fail("has an element at index " + index);
|
||||
failWithoutActual(fact("expected to have element at index", index));
|
||||
}
|
||||
return elementAssertThatFunction.apply(list.get(index));
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.truth;
|
||||
|
||||
import static com.google.common.truth.Fact.fact;
|
||||
import static com.google.common.truth.Truth.assertAbout;
|
||||
|
||||
import com.google.common.truth.DefaultSubject;
|
||||
@@ -57,7 +58,7 @@ public class OptionalSubject<S extends Subject<S, ? super T>, T>
|
||||
isNotNull();
|
||||
Optional<T> optional = actual();
|
||||
if (!optional.isPresent()) {
|
||||
fail("has a value");
|
||||
failWithoutActual(fact("expected to have", "value"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +66,7 @@ public class OptionalSubject<S extends Subject<S, ? super T>, T>
|
||||
isNotNull();
|
||||
Optional<T> optional = actual();
|
||||
if (optional.isPresent()) {
|
||||
fail("does not have a value");
|
||||
failWithoutActual(fact("expected not to have", "value"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user