Skip to content
Permalink
Browse files

Upgrade to Truth 1.0 (#281)

* Upgrade to Truth 1.0

Refactored fail(...) to assertWithMessage().fail().

Upgraded com.google.monitoring-client family of dependencies to 1.0.6

Also fixed bad use of io.StringIO (on binary buffer) recently introduced to
google-java-format-diff.py.
  • Loading branch information...
weiminyu committed Sep 24, 2019
1 parent 3009f75 commit b0c13042a6b41e1e77c5f5e10358bf3d90aa3580
Showing with 235 additions and 240 deletions.
  1. +2 −2 buildSrc/gradle/dependency-locks/testCompile.lockfile
  2. +2 −2 buildSrc/gradle/dependency-locks/testCompileClasspath.lockfile
  3. +2 −2 buildSrc/gradle/dependency-locks/testRuntimeClasspath.lockfile
  4. +2 −2 core/gradle/dependency-locks/compile.lockfile
  5. +2 −2 core/gradle/dependency-locks/compileClasspath.lockfile
  6. +2 −2 core/gradle/dependency-locks/default.lockfile
  7. +2 −2 core/gradle/dependency-locks/runtime.lockfile
  8. +2 −2 core/gradle/dependency-locks/runtimeClasspath.lockfile
  9. +5 −5 core/gradle/dependency-locks/testCompile.lockfile
  10. +5 −5 core/gradle/dependency-locks/testCompileClasspath.lockfile
  11. +5 −5 core/gradle/dependency-locks/testRuntime.lockfile
  12. +5 −5 core/gradle/dependency-locks/testRuntimeClasspath.lockfile
  13. +5 −4 core/src/test/java/google/registry/dns/writer/dnsupdate/DnsUpdateWriterTest.java
  14. +2 −2 core/src/test/java/google/registry/documentation/FlowDocumentationTest.java
  15. +2 −2 core/src/test/java/google/registry/mapreduce/inputs/ChildEntityInputTest.java
  16. +4 −4 core/src/test/java/google/registry/mapreduce/inputs/CommitLogManifestInputTest.java
  17. +3 −3 core/src/test/java/google/registry/mapreduce/inputs/EppResourceInputsTest.java
  18. +2 −3 core/src/test/java/google/registry/model/EntityTestCase.java
  19. +2 −2 core/src/test/java/google/registry/security/JsonHttpTestUtils.java
  20. +2 −2 core/src/test/java/google/registry/testing/AppEngineRule.java
  21. +7 −8 core/src/test/java/google/registry/testing/GoldenFileTestHelper.java
  22. +5 −6 core/src/test/java/google/registry/testing/TaskQueueHelper.java
  23. +2 −2 core/src/test/java/google/registry/testing/TestLogHandlerUtils.java
  24. +6 −8 core/src/test/java/google/registry/xml/XmlTestUtils.java
  25. +1 −1 db/gradle/dependency-locks/testCompile.lockfile
  26. +1 −1 db/gradle/dependency-locks/testCompileClasspath.lockfile
  27. +1 −1 db/gradle/dependency-locks/testRuntime.lockfile
  28. +1 −1 db/gradle/dependency-locks/testRuntimeClasspath.lockfile
  29. +0 −1 db/src/test/java/google/registry/testing/TextDiffSubject.java
  30. +5 −5 dependencies.gradle
  31. +1 −1 java-format/google-java-format-diff.py
  32. +1 −1 prober/gradle/dependency-locks/compile.lockfile
  33. +1 −1 prober/gradle/dependency-locks/compileClasspath.lockfile
  34. +1 −1 prober/gradle/dependency-locks/default.lockfile
  35. +1 −1 prober/gradle/dependency-locks/runtime.lockfile
  36. +1 −1 prober/gradle/dependency-locks/runtimeClasspath.lockfile
  37. +5 −5 prober/gradle/dependency-locks/testCompile.lockfile
  38. +5 −5 prober/gradle/dependency-locks/testCompileClasspath.lockfile
  39. +5 −5 prober/gradle/dependency-locks/testRuntime.lockfile
  40. +5 −5 prober/gradle/dependency-locks/testRuntimeClasspath.lockfile
  41. +2 −2 proxy/gradle/dependency-locks/compile.lockfile
  42. +2 −2 proxy/gradle/dependency-locks/compileClasspath.lockfile
  43. +2 −2 proxy/gradle/dependency-locks/default.lockfile
  44. +2 −2 proxy/gradle/dependency-locks/runtime.lockfile
  45. +2 −2 proxy/gradle/dependency-locks/runtimeClasspath.lockfile
  46. +5 −5 proxy/gradle/dependency-locks/testCompile.lockfile
  47. +5 −5 proxy/gradle/dependency-locks/testCompileClasspath.lockfile
  48. +5 −5 proxy/gradle/dependency-locks/testRuntime.lockfile
  49. +5 −5 proxy/gradle/dependency-locks/testRuntimeClasspath.lockfile
  50. +2 −2 services/backend/gradle/dependency-locks/compile.lockfile
  51. +2 −2 services/backend/gradle/dependency-locks/compileClasspath.lockfile
  52. +2 −2 services/backend/gradle/dependency-locks/default.lockfile
  53. +2 −2 services/backend/gradle/dependency-locks/runtime.lockfile
  54. +2 −2 services/backend/gradle/dependency-locks/runtimeClasspath.lockfile
  55. +2 −2 services/backend/gradle/dependency-locks/testCompile.lockfile
  56. +2 −2 services/backend/gradle/dependency-locks/testCompileClasspath.lockfile
  57. +2 −2 services/backend/gradle/dependency-locks/testRuntime.lockfile
  58. +2 −2 services/backend/gradle/dependency-locks/testRuntimeClasspath.lockfile
  59. +2 −2 services/default/gradle/dependency-locks/compile.lockfile
  60. +2 −2 services/default/gradle/dependency-locks/compileClasspath.lockfile
  61. +2 −2 services/default/gradle/dependency-locks/default.lockfile
  62. +2 −2 services/default/gradle/dependency-locks/runtime.lockfile
  63. +2 −2 services/default/gradle/dependency-locks/runtimeClasspath.lockfile
  64. +2 −2 services/default/gradle/dependency-locks/testCompile.lockfile
  65. +2 −2 services/default/gradle/dependency-locks/testCompileClasspath.lockfile
  66. +2 −2 services/default/gradle/dependency-locks/testRuntime.lockfile
  67. +2 −2 services/default/gradle/dependency-locks/testRuntimeClasspath.lockfile
  68. +2 −2 services/pubapi/gradle/dependency-locks/compile.lockfile
  69. +2 −2 services/pubapi/gradle/dependency-locks/compileClasspath.lockfile
  70. +2 −2 services/pubapi/gradle/dependency-locks/default.lockfile
  71. +2 −2 services/pubapi/gradle/dependency-locks/runtime.lockfile
  72. +2 −2 services/pubapi/gradle/dependency-locks/runtimeClasspath.lockfile
  73. +2 −2 services/pubapi/gradle/dependency-locks/testCompile.lockfile
  74. +2 −2 services/pubapi/gradle/dependency-locks/testCompileClasspath.lockfile
  75. +2 −2 services/pubapi/gradle/dependency-locks/testRuntime.lockfile
  76. +2 −2 services/pubapi/gradle/dependency-locks/testRuntimeClasspath.lockfile
  77. +2 −2 services/tools/gradle/dependency-locks/compile.lockfile
  78. +2 −2 services/tools/gradle/dependency-locks/compileClasspath.lockfile
  79. +2 −2 services/tools/gradle/dependency-locks/default.lockfile
  80. +2 −2 services/tools/gradle/dependency-locks/runtime.lockfile
  81. +2 −2 services/tools/gradle/dependency-locks/runtimeClasspath.lockfile
  82. +2 −2 services/tools/gradle/dependency-locks/testCompile.lockfile
  83. +2 −2 services/tools/gradle/dependency-locks/testCompileClasspath.lockfile
  84. +2 −2 services/tools/gradle/dependency-locks/testRuntime.lockfile
  85. +2 −2 services/tools/gradle/dependency-locks/testRuntimeClasspath.lockfile
  86. +5 −5 util/gradle/dependency-locks/testCompile.lockfile
  87. +5 −5 util/gradle/dependency-locks/testCompileClasspath.lockfile
  88. +5 −5 util/gradle/dependency-locks/testRuntime.lockfile
  89. +5 −5 util/gradle/dependency-locks/testRuntimeClasspath.lockfile
@@ -35,8 +35,8 @@ com.google.oauth-client:google-oauth-client:1.27.0
com.google.protobuf:protobuf-java-util:3.6.1
com.google.protobuf:protobuf-java:3.6.1
com.google.template:soy:2018-03-14
com.google.truth.extensions:truth-java8-extension:0.45
com.google.truth:truth:0.45
com.google.truth.extensions:truth-java8-extension:1.0
com.google.truth:truth:1.0
com.googlecode.java-diff-utils:diffutils:1.3.0
com.ibm.icu:icu4j:57.1
commons-codec:commons-codec:1.11
@@ -35,8 +35,8 @@ com.google.oauth-client:google-oauth-client:1.27.0
com.google.protobuf:protobuf-java-util:3.6.1
com.google.protobuf:protobuf-java:3.6.1
com.google.template:soy:2018-03-14
com.google.truth.extensions:truth-java8-extension:0.45
com.google.truth:truth:0.45
com.google.truth.extensions:truth-java8-extension:1.0
com.google.truth:truth:1.0
com.googlecode.java-diff-utils:diffutils:1.3.0
com.ibm.icu:icu4j:57.1
commons-codec:commons-codec:1.11
@@ -35,8 +35,8 @@ com.google.oauth-client:google-oauth-client:1.27.0
com.google.protobuf:protobuf-java-util:3.6.1
com.google.protobuf:protobuf-java:3.6.1
com.google.template:soy:2018-03-14
com.google.truth.extensions:truth-java8-extension:0.45
com.google.truth:truth:0.45
com.google.truth.extensions:truth-java8-extension:1.0
com.google.truth:truth:1.0
com.googlecode.java-diff-utils:diffutils:1.3.0
com.ibm.icu:icu4j:57.1
commons-codec:commons-codec:1.11
@@ -94,8 +94,8 @@ com.google.inject.extensions:guice-multibindings:4.1.0
com.google.inject:guice:4.1.0
com.google.j2objc:j2objc-annotations:1.3
com.google.jsinterop:jsinterop-annotations:1.0.2
com.google.monitoring-client:metrics:1.0.4
com.google.monitoring-client:stackdriver:1.0.4
com.google.monitoring-client:metrics:1.0.6
com.google.monitoring-client:stackdriver:1.0.6
com.google.oauth-client:google-oauth-client-appengine:1.29.0
com.google.oauth-client:google-oauth-client-java6:1.28.0
com.google.oauth-client:google-oauth-client-jetty:1.28.0
@@ -93,8 +93,8 @@ com.google.inject.extensions:guice-multibindings:4.1.0
com.google.inject:guice:4.1.0
com.google.j2objc:j2objc-annotations:1.3
com.google.jsinterop:jsinterop-annotations:1.0.2
com.google.monitoring-client:metrics:1.0.4
com.google.monitoring-client:stackdriver:1.0.4
com.google.monitoring-client:metrics:1.0.6
com.google.monitoring-client:stackdriver:1.0.6
com.google.oauth-client:google-oauth-client-appengine:1.29.0
com.google.oauth-client:google-oauth-client-java6:1.28.0
com.google.oauth-client:google-oauth-client-jetty:1.28.0
@@ -94,8 +94,8 @@ com.google.inject.extensions:guice-multibindings:4.1.0
com.google.inject:guice:4.1.0
com.google.j2objc:j2objc-annotations:1.3
com.google.jsinterop:jsinterop-annotations:1.0.2
com.google.monitoring-client:metrics:1.0.4
com.google.monitoring-client:stackdriver:1.0.4
com.google.monitoring-client:metrics:1.0.6
com.google.monitoring-client:stackdriver:1.0.6
com.google.oauth-client:google-oauth-client-appengine:1.29.0
com.google.oauth-client:google-oauth-client-java6:1.28.0
com.google.oauth-client:google-oauth-client-jetty:1.28.0
@@ -94,8 +94,8 @@ com.google.inject.extensions:guice-multibindings:4.1.0
com.google.inject:guice:4.1.0
com.google.j2objc:j2objc-annotations:1.3
com.google.jsinterop:jsinterop-annotations:1.0.2
com.google.monitoring-client:metrics:1.0.4
com.google.monitoring-client:stackdriver:1.0.4
com.google.monitoring-client:metrics:1.0.6
com.google.monitoring-client:stackdriver:1.0.6
com.google.oauth-client:google-oauth-client-appengine:1.29.0
com.google.oauth-client:google-oauth-client-java6:1.28.0
com.google.oauth-client:google-oauth-client-jetty:1.28.0
@@ -94,8 +94,8 @@ com.google.inject.extensions:guice-multibindings:4.1.0
com.google.inject:guice:4.1.0
com.google.j2objc:j2objc-annotations:1.3
com.google.jsinterop:jsinterop-annotations:1.0.2
com.google.monitoring-client:metrics:1.0.4
com.google.monitoring-client:stackdriver:1.0.4
com.google.monitoring-client:metrics:1.0.6
com.google.monitoring-client:stackdriver:1.0.6
com.google.oauth-client:google-oauth-client-appengine:1.29.0
com.google.oauth-client:google-oauth-client-java6:1.28.0
com.google.oauth-client:google-oauth-client-jetty:1.28.0
@@ -96,9 +96,9 @@ com.google.inject.extensions:guice-multibindings:4.1.0
com.google.inject:guice:4.1.0
com.google.j2objc:j2objc-annotations:1.3
com.google.jsinterop:jsinterop-annotations:1.0.2
com.google.monitoring-client:contrib:1.0.4
com.google.monitoring-client:metrics:1.0.4
com.google.monitoring-client:stackdriver:1.0.4
com.google.monitoring-client:contrib:1.0.6
com.google.monitoring-client:metrics:1.0.6
com.google.monitoring-client:stackdriver:1.0.6
com.google.oauth-client:google-oauth-client-appengine:1.29.0
com.google.oauth-client:google-oauth-client-java6:1.28.0
com.google.oauth-client:google-oauth-client-jetty:1.28.0
@@ -109,8 +109,8 @@ com.google.protobuf:protobuf-java-util:3.6.1
com.google.protobuf:protobuf-java:3.6.1
com.google.re2j:re2j:1.1
com.google.template:soy:2018-03-14
com.google.truth.extensions:truth-java8-extension:0.45
com.google.truth:truth:0.45
com.google.truth.extensions:truth-java8-extension:1.0
com.google.truth:truth:1.0
com.googlecode.charts4j:charts4j:1.3
com.googlecode.java-diff-utils:diffutils:1.3.0
com.googlecode.json-simple:json-simple:1.1.1
@@ -95,9 +95,9 @@ com.google.inject.extensions:guice-multibindings:4.1.0
com.google.inject:guice:4.1.0
com.google.j2objc:j2objc-annotations:1.3
com.google.jsinterop:jsinterop-annotations:1.0.2
com.google.monitoring-client:contrib:1.0.4
com.google.monitoring-client:metrics:1.0.4
com.google.monitoring-client:stackdriver:1.0.4
com.google.monitoring-client:contrib:1.0.6
com.google.monitoring-client:metrics:1.0.6
com.google.monitoring-client:stackdriver:1.0.6
com.google.oauth-client:google-oauth-client-appengine:1.29.0
com.google.oauth-client:google-oauth-client-java6:1.28.0
com.google.oauth-client:google-oauth-client-jetty:1.28.0
@@ -108,8 +108,8 @@ com.google.protobuf:protobuf-java-util:3.6.1
com.google.protobuf:protobuf-java:3.6.1
com.google.re2j:re2j:1.1
com.google.template:soy:2018-03-14
com.google.truth.extensions:truth-java8-extension:0.45
com.google.truth:truth:0.45
com.google.truth.extensions:truth-java8-extension:1.0
com.google.truth:truth:1.0
com.googlecode.charts4j:charts4j:1.3
com.googlecode.java-diff-utils:diffutils:1.3.0
com.googlecode.json-simple:json-simple:1.1.1
@@ -107,9 +107,9 @@ com.google.inject.extensions:guice-multibindings:4.1.0
com.google.inject:guice:4.1.0
com.google.j2objc:j2objc-annotations:1.3
com.google.jsinterop:jsinterop-annotations:1.0.2
com.google.monitoring-client:contrib:1.0.4
com.google.monitoring-client:metrics:1.0.4
com.google.monitoring-client:stackdriver:1.0.4
com.google.monitoring-client:contrib:1.0.6
com.google.monitoring-client:metrics:1.0.6
com.google.monitoring-client:stackdriver:1.0.6
com.google.oauth-client:google-oauth-client-appengine:1.29.0
com.google.oauth-client:google-oauth-client-java6:1.28.0
com.google.oauth-client:google-oauth-client-jetty:1.28.0
@@ -120,8 +120,8 @@ com.google.protobuf:protobuf-java-util:3.6.1
com.google.protobuf:protobuf-java:3.6.1
com.google.re2j:re2j:1.1
com.google.template:soy:2018-03-14
com.google.truth.extensions:truth-java8-extension:0.45
com.google.truth:truth:0.45
com.google.truth.extensions:truth-java8-extension:1.0
com.google.truth:truth:1.0
com.googlecode.charts4j:charts4j:1.3
com.googlecode.java-diff-utils:diffutils:1.3.0
com.googlecode.json-simple:json-simple:1.1.1
@@ -107,9 +107,9 @@ com.google.inject.extensions:guice-multibindings:4.1.0
com.google.inject:guice:4.1.0
com.google.j2objc:j2objc-annotations:1.3
com.google.jsinterop:jsinterop-annotations:1.0.2
com.google.monitoring-client:contrib:1.0.4
com.google.monitoring-client:metrics:1.0.4
com.google.monitoring-client:stackdriver:1.0.4
com.google.monitoring-client:contrib:1.0.6
com.google.monitoring-client:metrics:1.0.6
com.google.monitoring-client:stackdriver:1.0.6
com.google.oauth-client:google-oauth-client-appengine:1.29.0
com.google.oauth-client:google-oauth-client-java6:1.28.0
com.google.oauth-client:google-oauth-client-jetty:1.28.0
@@ -120,8 +120,8 @@ com.google.protobuf:protobuf-java-util:3.6.1
com.google.protobuf:protobuf-java:3.6.1
com.google.re2j:re2j:1.1
com.google.template:soy:2018-03-14
com.google.truth.extensions:truth-java8-extension:0.45
com.google.truth:truth:0.45
com.google.truth.extensions:truth-java8-extension:1.0
com.google.truth:truth:1.0
com.googlecode.charts4j:charts4j:1.3
com.googlecode.java-diff-utils:diffutils:1.3.0
com.googlecode.json-simple:json-simple:1.1.1
@@ -16,7 +16,7 @@

import static com.google.common.io.BaseEncoding.base16;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assert_;
import static com.google.common.truth.Truth.assertWithMessage;
import static google.registry.testing.DatastoreHelper.createTld;
import static google.registry.testing.DatastoreHelper.newDomainBase;
import static google.registry.testing.DatastoreHelper.newHostResource;
@@ -450,9 +450,10 @@ private void assertThatUpdateAdds(
return fixIterator(Record.class, set.rrs());
}
}
assert_().fail(
"No record set found for resource '%s' type '%s'",
resourceName, Type.string(recordType));
assertWithMessage(
"No record set found for resource '%s' type '%s'",
resourceName, Type.string(recordType))
.fail();
throw new AssertionError();
}

@@ -14,7 +14,7 @@

package google.registry.documentation;

import static com.google.common.truth.Truth.assert_;
import static com.google.common.truth.Truth.assertWithMessage;
import static google.registry.util.BuildPathUtils.getProjectRoot;
import static java.nio.charset.StandardCharsets.UTF_8;

@@ -53,7 +53,7 @@ public void testGeneratedMatchesGolden() throws IOException {
// Don't use Truth's isEqualTo() because the output is huge and unreadable for large files.
DocumentationGenerator generator = new DocumentationGenerator();
if (!generator.generateMarkdown().equals(goldenMarkdown)) {
assert_().fail(UPDATE_INSTRUCTIONS);
assertWithMessage(UPDATE_INSTRUCTIONS).fail();
}
}
}
@@ -15,7 +15,7 @@
package google.registry.mapreduce.inputs;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assert_;
import static com.google.common.truth.Truth.assertWithMessage;
import static google.registry.mapreduce.inputs.EppResourceInputs.createChildEntityInput;
import static google.registry.model.index.EppResourceIndexBucket.getBucketKey;
import static google.registry.testing.DatastoreHelper.createTld;
@@ -290,7 +290,7 @@ public void testSuccess_childEntityReader_oneReaderPerBucket() throws Exception
seen.add(reader.next());
try {
ImmutableObject o = reader.next();
assert_().fail("Unexpected element: " + o);
assertWithMessage("Unexpected element: %s", o).fail();
} catch (NoSuchElementException expected) {
}
}
@@ -15,7 +15,7 @@
package google.registry.mapreduce.inputs;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assert_;
import static com.google.common.truth.Truth.assertWithMessage;

import com.google.appengine.tools.mapreduce.Input;
import com.google.appengine.tools.mapreduce.InputReader;
@@ -65,7 +65,7 @@ public void testInputOlderThan_allFound() throws Exception {
seen.add(reader.next());
try {
Key<CommitLogManifest> key = reader.next();
assert_().fail("Unexpected element: " + key);
assertWithMessage("Unexpected element: %s", key).fail();
} catch (NoSuchElementException expected) {
}
}
@@ -93,7 +93,7 @@ public void testInputOlderThan_skipsNew() throws Exception {
key = reader.next();
seen.add(key);
}
assert_().fail("Unexpected element: " + key);
assertWithMessage("Unexpected element: %s", key).fail();
} catch (NoSuchElementException expected) {
}
}
@@ -121,7 +121,7 @@ public void testInputAll() throws Exception {
key = reader.next();
seen.add(key);
}
assert_().fail("Unexpected element: " + key);
assertWithMessage("Unexpected element: %s", key).fail();
} catch (NoSuchElementException expected) {
}
}
@@ -15,7 +15,7 @@
package google.registry.mapreduce.inputs;

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assert_;
import static com.google.common.truth.Truth.assertWithMessage;
import static google.registry.mapreduce.inputs.EppResourceInputs.createEntityInput;
import static google.registry.mapreduce.inputs.EppResourceInputs.createKeyInput;
import static google.registry.model.index.EppResourceIndexBucket.getBucketKey;
@@ -123,7 +123,7 @@ public void testKeyInput_oneReaderPerBucket() throws Exception {
seen.add(reader.next());
try {
Key<DomainBase> key = reader.next();
assert_().fail("Unexpected element: " + key);
assertWithMessage("Unexpected element: %s", key).fail();
} catch (NoSuchElementException expected) {
}
}
@@ -148,7 +148,7 @@ public void testEntityInput_oneReaderPerBucket() throws Exception {
seen.add(reader.next());
try {
DomainBase domain = reader.next();
assert_().fail("Unexpected element: " + domain);
assertWithMessage("Unexpected element: %s", domain).fail();
} catch (NoSuchElementException expected) {
}
}
@@ -16,7 +16,6 @@

import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
import static com.google.common.truth.Truth.assert_;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static org.joda.time.DateTimeZone.UTC;

@@ -127,10 +126,10 @@ private void verifyIndexingHelper(
// If the field's type was not indexable (because it's not a supported Datastore type) then
// this error will be thrown. If we expected no indexing, that's fine. Otherwise, fail.
if (indexed || !e.getMessage().endsWith(" is not a supported property type.")) {
assert_().fail(String.format("%s was %sindexed", fieldPath, indexed ? "not " : ""));
assertWithMessage("%s was %sindexed", fieldPath, indexed ? "not " : "").fail();
}
} catch (IllegalStateException e) {
assert_().fail(String.format("%s (indexed=%b): %s", fieldPath, indexed, e.getMessage()));
assertWithMessage("%s (indexed=%b): %s", fieldPath, indexed, e.getMessage()).fail();
}
}
}
@@ -16,7 +16,7 @@

import static com.google.common.base.Suppliers.memoize;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assert_;
import static com.google.common.truth.Truth.assertWithMessage;
import static google.registry.security.JsonHttp.JSON_SAFETY_PREFIX;

import com.google.common.base.Supplier;
@@ -62,7 +62,7 @@ public static BufferedReader createJsonPayload(String jsonText) {
Map<String, Object> json = (Map<String, Object>) JSONValue.parseWithException(jsonText);
return json;
} catch (ClassCastException | ParseException e) {
assert_().fail("Bad JSON: %s\n%s", e.getMessage(), jsonText);
assertWithMessage("Bad JSON: %s\n%s", e.getMessage(), jsonText).fail();
throw new AssertionError();
}
}
@@ -14,7 +14,7 @@

package google.registry.testing;

import static com.google.common.truth.Truth.assert_;
import static com.google.common.truth.Truth.assertWithMessage;
import static google.registry.testing.DatastoreHelper.persistSimpleResources;
import static google.registry.util.ResourceUtils.readResourceUtf8;
import static java.nio.charset.StandardCharsets.UTF_8;
@@ -338,7 +338,7 @@ protected void after() {
Set<String> autoIndexes = getIndexXmlStrings(indexFileContent);
Set<String> missingIndexes = Sets.difference(autoIndexes, MANUAL_INDEXES);
if (!missingIndexes.isEmpty()) {
assert_().fail("Missing indexes:\n%s", Joiner.on('\n').join(missingIndexes));
assertWithMessage("Missing indexes:\n%s", Joiner.on('\n').join(missingIndexes)).fail();
}
} catch (IOException e) {
throw new RuntimeException(e);
@@ -16,7 +16,7 @@

import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.truth.Truth.assert_;
import static com.google.common.truth.Truth.assertWithMessage;
import static google.registry.testing.TestDataHelper.filePath;
import static google.registry.testing.TestDataHelper.loadFile;

@@ -80,13 +80,12 @@ public void isEqualToGolden(Class<?> context, String filename) {
logger.atWarning().log(
"Actual routing map was:\n%s\n\nExpected routing map was:\n%s\n",
actualValue, expectedValue);
assert_()
.fail(
String.format(
UPDATE_INSTRUCTIONS,
nomulusCommand,
filePath(context, filename),
goldenFileDescription));
assertWithMessage(
UPDATE_INSTRUCTIONS,
nomulusCommand,
filePath(context, filename),
goldenFileDescription)
.fail();
}
}

0 comments on commit b0c1304

Please sign in to comment.
You can’t perform that action at this time.