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:
cpovirk 2019-04-29 09:38:14 -07:00 committed by jianglai
parent de5f3e6177
commit 124d7375c3
11 changed files with 40 additions and 34 deletions

View file

@ -16,6 +16,7 @@ package google.registry.rde;
import static com.google.common.io.BaseEncoding.base16;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static com.google.common.truth.Truth8.assertThat;
import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newDomainBase;
@ -147,9 +148,9 @@ public class DomainBaseToXjcConverterTest {
assertThat(bean.getRgpStatuses().stream().map(XjcRgpStatusType::getS))
.containsExactly(TRANSFER_PERIOD, RENEW_PERIOD);
assertThat(bean.getSecDNS()).named("secdns").isNotNull();
assertThat(bean.getSecDNS().getDsDatas()).named("secdns dsdata").isNotNull();
assertThat(bean.getSecDNS().getDsDatas()).named("secdns dsdata").hasSize(1);
assertWithMessage("secdns").that(bean.getSecDNS()).isNotNull();
assertWithMessage("secdns dsdata").that(bean.getSecDNS().getDsDatas()).isNotNull();
assertWithMessage("secdns dsdata").that(bean.getSecDNS().getDsDatas()).hasSize(1);
XjcSecdnsDsDataType dsData = bean.getSecDNS().getDsDatas().get(0);
assertThat(dsData.getAlg()).isEqualTo((short) 200);
assertThat(dsData.getDigest()).isEqualTo(base16().decode("1234567890"));