Don't use Subject#named anymore

Subject#named is being removed. As recommended, migrate from
assertThat(foo).named("foo") to assertWithMessage("foo").that(foo).

Change-Id: Ie5266c993dcd96270db07ff399c1e4877f71718c
This commit is contained in:
Alice Kober-Sotzek
2019-05-17 11:30:25 +02:00
parent c24e76f588
commit d77b89ebcf
2 changed files with 6 additions and 4 deletions

View File

@@ -15,6 +15,7 @@
package com.google.gerrit.acceptance.ssh;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import com.google.common.collect.Lists;
import com.google.gerrit.acceptance.AbstractDaemonTest;
@@ -294,8 +295,8 @@ public class QueryIT extends AbstractDaemonTest {
// computation while formatting the output, such as labels, reviewers etc.
merge(r);
for (ListChangesOption option : ListChangesOption.values()) {
assertThat(gApi.changes().query(r.getChangeId()).withOption(option).get())
.named("Option: " + option)
assertWithMessage("Option: " + option)
.that(gApi.changes().query(r.getChangeId()).withOption(option).get())
.hasSize(1);
}
}

View File

@@ -15,6 +15,7 @@
package com.google.gerrit.metrics.proc;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static com.google.gerrit.testing.GerritJUnit.assertThrows;
import com.codahale.metrics.Counter;
@@ -166,8 +167,8 @@ public class ProcMetricModuleTest {
private <M extends Metric> M get(String name, Class<M> type) {
Metric m = registry.getMetrics().get(name);
assertThat(m).named(name).isNotNull();
assertThat(m).named(name).isInstanceOf(type);
assertWithMessage(name).that(m).isNotNull();
assertWithMessage(name).that(m).isInstanceOf(type);
@SuppressWarnings("unchecked")
M result = (M) m;