Automatic code cleanup.
PiperOrigin-RevId: 239211413
diff --git a/src/test/java/com/google/devtools/build/android/desugar/DesugarFunctionalTest.java b/src/test/java/com/google/devtools/build/android/desugar/DesugarFunctionalTest.java
index 14e8f37..5092961 100644
--- a/src/test/java/com/google/devtools/build/android/desugar/DesugarFunctionalTest.java
+++ b/src/test/java/com/google/devtools/build/android/desugar/DesugarFunctionalTest.java
@@ -205,7 +205,7 @@
stringer.call();
fail("IOException expected");
} catch (IOException expected) {
- assertThat(expected).hasMessage("SergeyLarry");
+ assertThat(expected).hasMessageThat().isEqualTo("SergeyLarry");
} catch (Exception e) {
throw e;
}
@@ -249,7 +249,7 @@
ConstructorReference unused = ConstructorReference.emptyThroughJavacGeneratedBridge().get();
fail("RuntimeException expected");
} catch (RuntimeException expected) {
- assertThat(expected).hasMessage("got it!");
+ assertThat(expected).hasMessageThat().isEqualTo("got it!");
}
}
diff --git a/src/test/java/com/google/devtools/build/android/dexer/DexFileAggregatorTest.java b/src/test/java/com/google/devtools/build/android/dexer/DexFileAggregatorTest.java
index f630e6f..c578229 100644
--- a/src/test/java/com/google/devtools/build/android/dexer/DexFileAggregatorTest.java
+++ b/src/test/java/com/google/devtools/build/android/dexer/DexFileAggregatorTest.java
@@ -107,7 +107,7 @@
try {
dexer.close();
} catch (IllegalStateException e) {
- assertThat(e).hasMessage("--forceJumbo flag not supported");
+ assertThat(e).hasMessageThat().isEqualTo("--forceJumbo flag not supported");
System.err.println("Skipping this test due to missing --forceJumbo support in Android SDK.");
e.printStackTrace();
return;
diff --git a/src/test/java/com/google/devtools/build/android/dexer/DexFileMergerTest.java b/src/test/java/com/google/devtools/build/android/dexer/DexFileMergerTest.java
index 18175c1..4a24baa 100644
--- a/src/test/java/com/google/devtools/build/android/dexer/DexFileMergerTest.java
+++ b/src/test/java/com/google/devtools/build/android/dexer/DexFileMergerTest.java
@@ -221,7 +221,8 @@
fail("Expected DexFileMerger to fail");
} catch (IllegalArgumentException e) {
assertThat(e)
- .hasMessage(
+ .hasMessageThat()
+ .isEqualTo(
"--minimal-main-dex is only supported with multidex enabled, but mode is: OFF");
}
try {
@@ -237,7 +238,8 @@
fail("Expected DexFileMerger to fail");
} catch (IllegalArgumentException e) {
assertThat(e)
- .hasMessage("--main-dex-list is only supported with multidex enabled, but mode is: OFF");
+ .hasMessageThat()
+ .isEqualTo("--main-dex-list is only supported with multidex enabled, but mode is: OFF");
}
}
@@ -251,7 +253,7 @@
MultidexStrategy.OFF, /*mainDexList=*/ null, /*minimalMainDex=*/ false, DEX_PREFIX,
dexArchive);
} catch (IllegalStateException e) {
- assertThat(e).hasMessage("--forceJumbo flag not supported");
+ assertThat(e).hasMessageThat().isEqualTo("--forceJumbo flag not supported");
System.err.println("Skipping this test due to missing --forceJumbo support in Android SDK.");
e.printStackTrace();
return;
diff --git a/src/test/java/com/google/devtools/build/lib/actions/FailActionTest.java b/src/test/java/com/google/devtools/build/lib/actions/FailActionTest.java
index c1eac8e..d640043 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/FailActionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/FailActionTest.java
@@ -58,7 +58,7 @@
failAction.execute(null);
fail();
} catch (ActionExecutionException e) {
- assertThat(e).hasMessage(errorMessage);
+ assertThat(e).hasMessageThat().isEqualTo(errorMessage);
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java
index cb44c89..f7be141 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java
@@ -437,7 +437,7 @@
useConfiguration("--output directory name=foo");
fail();
} catch (OptionsParsingException e) {
- assertThat(e).hasMessage("Unrecognized option: --output directory name=foo");
+ assertThat(e).hasMessageThat().isEqualTo("Unrecognized option: --output directory name=foo");
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/config/RunUnderConverterTest.java b/src/test/java/com/google/devtools/build/lib/analysis/config/RunUnderConverterTest.java
index 70e8d00..423f21b 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/config/RunUnderConverterTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/config/RunUnderConverterTest.java
@@ -55,7 +55,7 @@
new RunUnderConverter().convert(input);
fail();
} catch (OptionsParsingException e) {
- assertThat(e).hasMessage(expectedError);
+ assertThat(e).hasMessageThat().isEqualTo(expectedError);
}
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/select/NonconfigurableAttributeMapperTest.java b/src/test/java/com/google/devtools/build/lib/analysis/select/NonconfigurableAttributeMapperTest.java
index 97ce65f..a3b7798e 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/select/NonconfigurableAttributeMapperTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/select/NonconfigurableAttributeMapperTest.java
@@ -55,8 +55,9 @@
fail("Expected NonconfigurableAttributeMapper to fail on a configurable attribute type");
} catch (IllegalStateException e) {
// Expected outcome.
- assertThat(e).hasMessage(
- "Attribute 'linkstatic' is potentially configurable - not allowed here");
+ assertThat(e)
+ .hasMessageThat()
+ .isEqualTo("Attribute 'linkstatic' is potentially configurable - not allowed here");
}
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitorTest.java b/src/test/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitorTest.java
index 7df53e5..adb2e03 100644
--- a/src/test/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitorTest.java
+++ b/src/test/java/com/google/devtools/build/lib/concurrent/AbstractQueueVisitorTest.java
@@ -152,7 +152,7 @@
counter.awaitQuiescence(/*interruptWorkers=*/ false);
fail();
} catch (Error expected) {
- assertThat(expected).hasMessage("Could not create thread (fakeout)");
+ assertThat(expected).hasMessageThat().isEqualTo("Could not create thread (fakeout)");
}
assertThat(counter.getCount()).isSameAs(5);
diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/CompileOneDependencyTransformerTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/CompileOneDependencyTransformerTest.java
index 7c49a68..1c6c59f 100644
--- a/src/test/java/com/google/devtools/build/lib/pkgcache/CompileOneDependencyTransformerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/pkgcache/CompileOneDependencyTransformerTest.java
@@ -172,9 +172,11 @@
parseCompileOneDep("//foo:missing.cc");
fail();
} catch (TargetParsingException e) {
- assertThat(e).hasMessage(
- "no such target '//foo:missing.cc': target 'missing.cc' not declared in package 'foo' "
- + "defined by /workspace/foo/BUILD");
+ assertThat(e)
+ .hasMessageThat()
+ .isEqualTo(
+ "no such target '//foo:missing.cc': target 'missing.cc' not declared in package "
+ + "'foo' defined by /workspace/foo/BUILD");
}
// Also, try a valid input file which has no dependent rules in its package.
@@ -182,7 +184,9 @@
parseCompileOneDep("//foo:baz/bang");
fail();
} catch (TargetParsingException e) {
- assertThat(e).hasMessage("Couldn't find dependency on target '//foo:baz/bang'");
+ assertThat(e)
+ .hasMessageThat()
+ .isEqualTo("Couldn't find dependency on target '//foo:baz/bang'");
}
// Try a header that is in a package but where no cc_library explicitly lists it.
@@ -190,9 +194,10 @@
parseCompileOneDep("//foo/bar:undeclared.h");
fail();
} catch (TargetParsingException e) {
- assertThat(e).hasMessage("Couldn't find dependency on target '//foo/bar:undeclared.h'");
+ assertThat(e)
+ .hasMessageThat()
+ .isEqualTo("Couldn't find dependency on target '//foo/bar:undeclared.h'");
}
-
}
@Test
@@ -202,7 +207,9 @@
parseCompileOneDep("//foo:foo1");
fail();
} catch (TargetParsingException e) {
- assertThat(e).hasMessage("--compile_one_dependency target '//foo:foo1' must be a file");
+ assertThat(e)
+ .hasMessageThat()
+ .isEqualTo("--compile_one_dependency target '//foo:foo1' must be a file");
}
}
@@ -243,7 +250,9 @@
parseCompileOneDep("//recursive:foo");
fail();
} catch (TargetParsingException e) {
- assertThat(e).hasMessage("Couldn't find dependency on target '//recursive:foo'");
+ assertThat(e)
+ .hasMessageThat()
+ .isEqualTo("Couldn't find dependency on target '//recursive:foo'");
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/pkgcache/PackageCacheTest.java b/src/test/java/com/google/devtools/build/lib/pkgcache/PackageCacheTest.java
index b5ab62c..0dc122e 100644
--- a/src/test/java/com/google/devtools/build/lib/pkgcache/PackageCacheTest.java
+++ b/src/test/java/com/google/devtools/build/lib/pkgcache/PackageCacheTest.java
@@ -258,7 +258,8 @@
fail();
} catch (NoSuchTargetException e) {
assertThat(e)
- .hasMessage(
+ .hasMessageThat()
+ .isEqualTo(
"no such target '//pkg1:not-there': target 'not-there' "
+ "not declared in package 'pkg1' defined by /workspace/pkg1/BUILD");
}
@@ -546,7 +547,8 @@
fail();
} catch (NoSuchPackageException e) {
assertThat(e)
- .hasMessage(
+ .hasMessageThat()
+ .isEqualTo(
"no such package 'c/d': Package is considered deleted due to --deleted_packages");
}
diff --git a/src/test/java/com/google/devtools/build/lib/shell/ShellUtilsTest.java b/src/test/java/com/google/devtools/build/lib/shell/ShellUtilsTest.java
index 75433e6..062dcd9 100644
--- a/src/test/java/com/google/devtools/build/lib/shell/ShellUtilsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/shell/ShellUtilsTest.java
@@ -119,7 +119,7 @@
tokenize(new ArrayList<String>(), copts);
fail();
} catch (ShellUtils.TokenizationException e) {
- assertThat(e).hasMessage(expectedError);
+ assertThat(e).hasMessageThat().isEqualTo(expectedError);
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java b/src/test/java/com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java
index 5340aa0..ed879d0 100644
--- a/src/test/java/com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java
@@ -168,7 +168,7 @@
evalRuleContextCode(ruleContext, lines);
fail();
} catch (EvalException e) {
- assertThat(e).hasMessage(errorMsg);
+ assertThat(e).hasMessageThat().isEqualTo(errorMsg);
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/testutil/MoreAssertsTest.java b/src/test/java/com/google/devtools/build/lib/testutil/MoreAssertsTest.java
index 372ede2..e09ccb8 100644
--- a/src/test/java/com/google/devtools/build/lib/testutil/MoreAssertsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/testutil/MoreAssertsTest.java
@@ -88,19 +88,19 @@
assertDoesNotContainSublist(actual, "a");
fail("no exception thrown");
} catch (AssertionError e) {
- assertThat(e).hasMessage("Found [a] as a sublist of [a, b, c]");
+ assertThat(e).hasMessageThat().isEqualTo("Found [a] as a sublist of [a, b, c]");
}
try {
assertDoesNotContainSublist(actual, "b");
fail("no exception thrown");
} catch (AssertionError e) {
- assertThat(e).hasMessage("Found [b] as a sublist of [a, b, c]");
+ assertThat(e).hasMessageThat().isEqualTo("Found [b] as a sublist of [a, b, c]");
}
try {
assertDoesNotContainSublist(actual, "c");
fail("no exception thrown");
} catch (AssertionError e) {
- assertThat(e).hasMessage("Found [c] as a sublist of [a, b, c]");
+ assertThat(e).hasMessageThat().isEqualTo("Found [c] as a sublist of [a, b, c]");
}
// All two-string combinations.
@@ -108,13 +108,13 @@
assertDoesNotContainSublist(actual, "a", "b");
fail("no exception thrown");
} catch (AssertionError e) {
- assertThat(e).hasMessage("Found [a, b] as a sublist of [a, b, c]");
+ assertThat(e).hasMessageThat().isEqualTo("Found [a, b] as a sublist of [a, b, c]");
}
try {
assertDoesNotContainSublist(actual, "b", "c");
fail("no exception thrown");
} catch (AssertionError e) {
- assertThat(e).hasMessage("Found [b, c] as a sublist of [a, b, c]");
+ assertThat(e).hasMessageThat().isEqualTo("Found [b, c] as a sublist of [a, b, c]");
}
// The whole list.
@@ -122,7 +122,7 @@
assertDoesNotContainSublist(actual, "a", "b", "c");
fail("no exception thrown");
} catch (AssertionError e) {
- assertThat(e).hasMessage("Found [a, b, c] as a sublist of [a, b, c]");
+ assertThat(e).hasMessageThat().isEqualTo("Found [a, b, c] as a sublist of [a, b, c]");
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/unix/NativePosixFilesTest.java b/src/test/java/com/google/devtools/build/lib/unix/NativePosixFilesTest.java
index fff4289..0098934 100644
--- a/src/test/java/com/google/devtools/build/lib/unix/NativePosixFilesTest.java
+++ b/src/test/java/com/google/devtools/build/lib/unix/NativePosixFilesTest.java
@@ -90,7 +90,7 @@
NativePosixFiles.md5sum(testFile.getPathString());
fail("Expected FileAccessException, but wasn't thrown.");
} catch (FileAccessException e) {
- assertThat(e).hasMessage(testFile + " (Permission denied)");
+ assertThat(e).hasMessageThat().isEqualTo(testFile + " (Permission denied)");
}
}
@@ -100,7 +100,7 @@
NativePosixFiles.md5sum(testFile.getPathString());
fail("Expected FileNotFoundException, but wasn't thrown.");
} catch (FileNotFoundException e) {
- assertThat(e).hasMessage(testFile + " (No such file or directory)");
+ assertThat(e).hasMessageThat().isEqualTo(testFile + " (No such file or directory)");
}
}
@@ -111,10 +111,10 @@
NativePosixFiles.setWritable(foo);
fail("Expected FilePermissionException or IOException, but wasn't thrown.");
} catch (FilePermissionException e) {
- assertThat(e).hasMessage(foo + " (Operation not permitted)");
+ assertThat(e).hasMessageThat().isEqualTo(foo + " (Operation not permitted)");
} catch (IOException e) {
// When running in a sandbox, /bin might actually be a read-only file system.
- assertThat(e).hasMessage(foo + " (Read-only file system)");
+ assertThat(e).hasMessageThat().isEqualTo(foo + " (Read-only file system)");
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/util/CommandBuilderTest.java b/src/test/java/com/google/devtools/build/lib/util/CommandBuilderTest.java
index 99ee49d..d6e4682 100644
--- a/src/test/java/com/google/devtools/build/lib/util/CommandBuilderTest.java
+++ b/src/test/java/com/google/devtools/build/lib/util/CommandBuilderTest.java
@@ -52,7 +52,7 @@
builder.build();
fail("Expected exception");
} catch (Exception e) {
- assertThat(e).hasMessage(expected);
+ assertThat(e).hasMessageThat().isEqualTo(expected);
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/util/ResourceFileLoaderTest.java b/src/test/java/com/google/devtools/build/lib/util/ResourceFileLoaderTest.java
index 0f00b75..bce0fab 100644
--- a/src/test/java/com/google/devtools/build/lib/util/ResourceFileLoaderTest.java
+++ b/src/test/java/com/google/devtools/build/lib/util/ResourceFileLoaderTest.java
@@ -41,7 +41,7 @@
"does_not_exist.txt");
fail();
} catch (IOException e) {
- assertThat(e).hasMessage("does_not_exist.txt not found.");
+ assertThat(e).hasMessageThat().isEqualTo("does_not_exist.txt not found.");
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java b/src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java
index 6c37118..b34c2f5 100644
--- a/src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java
+++ b/src/test/java/com/google/devtools/build/lib/vfs/FileSystemTest.java
@@ -588,7 +588,7 @@
xFile.createDirectory();
fail();
} catch (IOException e) {
- assertThat(e).hasMessage(xFile + " (File exists)");
+ assertThat(e).hasMessageThat().isEqualTo(xFile + " (File exists)");
}
}
@@ -611,7 +611,7 @@
xChildOfReadonlyDir.createDirectory();
fail();
} catch (IOException e) {
- assertThat(e).hasMessage(xChildOfReadonlyDir + " (Permission denied)");
+ assertThat(e).hasMessageThat().isEqualTo(xChildOfReadonlyDir + " (Permission denied)");
}
}
@@ -634,7 +634,7 @@
FileSystemUtils.createEmptyFile(xChildOfReadonlyDir);
fail();
} catch (IOException e) {
- assertThat(e).hasMessage(xChildOfReadonlyDir + " (Permission denied)");
+ assertThat(e).hasMessageThat().isEqualTo(xChildOfReadonlyDir + " (Permission denied)");
}
}
@@ -689,7 +689,7 @@
if (ex instanceof FileNotFoundException) {
fail("The method should throw an object of class IOException.");
}
- assertThat(ex).hasMessage(xFile + " (Not a directory)");
+ assertThat(ex).hasMessageThat().isEqualTo(xFile + " (Not a directory)");
}
}
@@ -700,7 +700,7 @@
somePath.getDirectoryEntries();
fail("FileNotFoundException not thrown.");
} catch (Exception x) {
- assertThat(x).hasMessage(somePath + " (No such file or directory)");
+ assertThat(x).hasMessageThat().isEqualTo(somePath + " (No such file or directory)");
}
}
@@ -774,7 +774,7 @@
xNonEmptyDirectory.delete();
fail();
} catch (IOException e) {
- assertThat(e).hasMessage(xNonEmptyDirectory + " (Directory not empty)");
+ assertThat(e).hasMessageThat().isEqualTo(xNonEmptyDirectory + " (Directory not empty)");
}
}
@@ -860,7 +860,7 @@
newPath.getLastModifiedTime();
fail("FileNotFoundException not thrown!");
} catch (FileNotFoundException x) {
- assertThat(x).hasMessage(newPath + " (No such file or directory)");
+ assertThat(x).hasMessageThat().isEqualTo(newPath + " (No such file or directory)");
}
}
@@ -872,7 +872,7 @@
newPath.getFileSize();
fail("FileNotFoundException not thrown.");
} catch (FileNotFoundException e) {
- assertThat(e).hasMessage(newPath + " (No such file or directory)");
+ assertThat(e).hasMessageThat().isEqualTo(newPath + " (No such file or directory)");
}
}
@@ -976,7 +976,7 @@
xEmptyDirectory.getOutputStream();
fail("The Exception was not thrown!");
} catch (IOException ex) {
- assertThat(ex).hasMessage(xEmptyDirectory + " (Is a directory)");
+ assertThat(ex).hasMessageThat().isEqualTo(xEmptyDirectory + " (Is a directory)");
}
}
@@ -986,7 +986,7 @@
xEmptyDirectory.getInputStream();
fail("The Exception was not thrown!");
} catch (IOException ex) {
- assertThat(ex).hasMessage(xEmptyDirectory + " (Is a directory)");
+ assertThat(ex).hasMessageThat().isEqualTo(xEmptyDirectory + " (Is a directory)");
}
}
@@ -1046,7 +1046,9 @@
xEmptyDirectory.renameTo(xFile);
fail();
} catch (IOException e) {
- assertThat(e).hasMessage(xEmptyDirectory + " -> " + xFile + " (Not a directory)");
+ assertThat(e)
+ .hasMessageThat()
+ .isEqualTo(xEmptyDirectory + " -> " + xFile + " (Not a directory)");
}
}
@@ -1069,7 +1071,9 @@
xFile.renameTo(xEmptyDirectory);
fail();
} catch (IOException e) {
- assertThat(e).hasMessage(xFile + " -> " + xEmptyDirectory + " (Is a directory)");
+ assertThat(e)
+ .hasMessageThat()
+ .isEqualTo(xFile + " -> " + xEmptyDirectory + " (Is a directory)");
}
}
@@ -1142,7 +1146,7 @@
xNothing.isExecutable();
fail("No exception thrown.");
} catch (FileNotFoundException ex) {
- assertThat(ex).hasMessage(xNothing + " (No such file or directory)");
+ assertThat(ex).hasMessageThat().isEqualTo(xNothing + " (No such file or directory)");
}
}
@@ -1152,7 +1156,7 @@
xNothing.setExecutable(true);
fail("No exception thrown.");
} catch (FileNotFoundException ex) {
- assertThat(ex).hasMessage(xNothing + " (No such file or directory)");
+ assertThat(ex).hasMessageThat().isEqualTo(xNothing + " (No such file or directory)");
}
}
@@ -1162,7 +1166,7 @@
xNothing.isWritable();
fail("No exception thrown.");
} catch (FileNotFoundException ex) {
- assertThat(ex).hasMessage(xNothing + " (No such file or directory)");
+ assertThat(ex).hasMessageThat().isEqualTo(xNothing + " (No such file or directory)");
}
}
@@ -1172,7 +1176,7 @@
xNothing.setWritable(false);
fail("No exception thrown.");
} catch (FileNotFoundException ex) {
- assertThat(ex).hasMessage(xNothing + " (No such file or directory)");
+ assertThat(ex).hasMessageThat().isEqualTo(xNothing + " (No such file or directory)");
}
}
@@ -1220,7 +1224,7 @@
FileSystemUtils.writeContent(xFile, "hello, world!".getBytes(UTF_8));
fail("No exception thrown.");
} catch (IOException e) {
- assertThat(e).hasMessage(xFile + " (Permission denied)");
+ assertThat(e).hasMessageThat().isEqualTo(xFile + " (Permission denied)");
}
}
@@ -1232,7 +1236,7 @@
FileSystemUtils.readContent(xFile);
fail("No exception thrown.");
} catch (IOException e) {
- assertThat(e).hasMessage(xFile + " (Permission denied)");
+ assertThat(e).hasMessageThat().isEqualTo(xFile + " (Permission denied)");
}
}
@@ -1245,7 +1249,7 @@
FileSystemUtils.createEmptyFile(xNonEmptyDirectoryBar);
fail("No exception thrown.");
} catch (IOException e) {
- assertThat(e).hasMessage(xNonEmptyDirectoryBar + " (Permission denied)");
+ assertThat(e).hasMessageThat().isEqualTo(xNonEmptyDirectoryBar + " (Permission denied)");
}
}
@@ -1258,7 +1262,7 @@
xNonEmptyDirectoryBar.createDirectory();
fail("No exception thrown.");
} catch (IOException e) {
- assertThat(e).hasMessage(xNonEmptyDirectoryBar + " (Permission denied)");
+ assertThat(e).hasMessageThat().isEqualTo(xNonEmptyDirectoryBar + " (Permission denied)");
}
}
@@ -1295,7 +1299,7 @@
xNonEmptyDirectoryFoo.delete();
fail("No exception thrown.");
} catch (IOException e) {
- assertThat(e).hasMessage(xNonEmptyDirectoryFoo + " (Permission denied)");
+ assertThat(e).hasMessageThat().isEqualTo(xNonEmptyDirectoryFoo + " (Permission denied)");
}
}
@@ -1309,7 +1313,7 @@
createSymbolicLink(xNonEmptyDirectoryBar, xNonEmptyDirectoryFoo);
fail("No exception thrown.");
} catch (IOException e) {
- assertThat(e).hasMessage(xNonEmptyDirectoryBar + " (Permission denied)");
+ assertThat(e).hasMessageThat().isEqualTo(xNonEmptyDirectoryBar + " (Permission denied)");
}
}
}
@@ -1406,7 +1410,9 @@
xFile.createHardLink(xLink);
fail("expected FileNotFoundException: File \"xFile\" linked from \"xLink\" does not exist");
} catch (FileNotFoundException expected) {
- assertThat(expected).hasMessage("File \"xFile\" linked from \"xLink\" does not exist");
+ assertThat(expected)
+ .hasMessageThat()
+ .isEqualTo("File \"xFile\" linked from \"xLink\" does not exist");
}
assertThat(xFile.exists()).isFalse();
assertThat(xLink.exists()).isFalse();
@@ -1427,7 +1433,9 @@
xFile.createHardLink(xLink);
fail("expected FileNotFoundException: File \"xFile\" linked from \"xLink\" does not exist");
} catch (FileNotFoundException expected) {
- assertThat(expected).hasMessage("File \"xFile\" linked from \"xLink\" does not exist");
+ assertThat(expected)
+ .hasMessageThat()
+ .isEqualTo("File \"xFile\" linked from \"xLink\" does not exist");
}
assertThat(xFile.exists()).isFalse();
assertThat(xLink.exists()).isTrue();
@@ -1446,7 +1454,7 @@
xFile.createHardLink(xLink);
fail("expected FileAlreadyExistsException: New link file \"xLink\" already exists");
} catch (FileAlreadyExistsException expected) {
- assertThat(expected).hasMessage("New link file \"xLink\" already exists");
+ assertThat(expected).hasMessageThat().isEqualTo("New link file \"xLink\" already exists");
}
assertThat(xFile.exists()).isTrue();
assertThat(xLink.exists()).isTrue();
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/FileSystemUtilsTest.java b/src/test/java/com/google/devtools/build/lib/vfs/FileSystemUtilsTest.java
index 655bb93..cac3e38 100644
--- a/src/test/java/com/google/devtools/build/lib/vfs/FileSystemUtilsTest.java
+++ b/src/test/java/com/google/devtools/build/lib/vfs/FileSystemUtilsTest.java
@@ -467,8 +467,12 @@
copyFile(originalFile, aDir);
fail();
} catch (IOException ex) {
- assertThat(ex).hasMessage(
- "error copying file: couldn't delete destination: " + aDir + " (Directory not empty)");
+ assertThat(ex)
+ .hasMessageThat()
+ .isEqualTo(
+ "error copying file: couldn't delete destination: "
+ + aDir
+ + " (Directory not empty)");
}
}
@@ -515,7 +519,9 @@
FileSystemUtils.copyTreesBelow(topDir, aDir, Symlinks.FOLLOW);
fail("Should not be able to copy a directory to a subdir");
} catch (IllegalArgumentException expected) {
- assertThat(expected).hasMessage("/top-dir/a-dir is a subdirectory of /top-dir");
+ assertThat(expected)
+ .hasMessageThat()
+ .isEqualTo("/top-dir/a-dir is a subdirectory of /top-dir");
}
}
@@ -526,7 +532,7 @@
FileSystemUtils.copyTreesBelow(file1, aDir, Symlinks.FOLLOW);
fail("Should not be able to copy a file with copyDirectory method");
} catch (IOException expected) {
- assertThat(expected).hasMessage("/top-dir/file-1 (Not a directory)");
+ assertThat(expected).hasMessageThat().isEqualTo("/top-dir/file-1 (Not a directory)");
}
}
@@ -540,7 +546,7 @@
FileSystemUtils.copyTreesBelow(copyDir, file4, Symlinks.FOLLOW);
fail("Should not be able to copy a directory to a file");
} catch (IOException expected) {
- assertThat(expected).hasMessage("/file-4 (Not a directory)");
+ assertThat(expected).hasMessageThat().isEqualTo("/file-4 (Not a directory)");
}
}
@@ -553,7 +559,9 @@
FileSystemUtils.copyTreesBelow(unexistingDir, aDir, Symlinks.FOLLOW);
fail("Should not be able to copy from an unexisting path");
} catch (FileNotFoundException expected) {
- assertThat(expected).hasMessage("/unexisting-dir (No such file or directory)");
+ assertThat(expected)
+ .hasMessageThat()
+ .isEqualTo("/unexisting-dir (No such file or directory)");
}
}
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java b/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java
index ba7029d..a7bce7b 100644
--- a/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java
+++ b/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java
@@ -157,7 +157,7 @@
xDanglingLink.createDirectory();
fail();
} catch (IOException e) {
- assertThat(e).hasMessage(xDanglingLink + " (File exists)");
+ assertThat(e).hasMessageThat().isEqualTo(xDanglingLink + " (File exists)");
}
assertThat(xDanglingLink.isSymbolicLink()).isTrue(); // still a symbolic link
assertThat(xDanglingLink.isDirectory(Symlinks.FOLLOW)).isFalse(); // link still dangles
@@ -169,7 +169,7 @@
xLinkToDirectory.createDirectory();
fail();
} catch (IOException e) {
- assertThat(e).hasMessage(xLinkToDirectory + " (File exists)");
+ assertThat(e).hasMessageThat().isEqualTo(xLinkToDirectory + " (File exists)");
}
assertThat(xLinkToDirectory.isSymbolicLink()).isTrue(); // still a symbolic link
assertThat(xLinkToDirectory.isDirectory(Symlinks.FOLLOW)).isTrue(); // link still points to dir
@@ -270,7 +270,7 @@
link.resolveSymbolicLinks();
fail();
} catch (IOException e) {
- assertThat(e).hasMessage(link + " (Too many levels of symbolic links)");
+ assertThat(e).hasMessageThat().isEqualTo(link + " (Too many levels of symbolic links)");
}
}
}
@@ -287,7 +287,7 @@
link1.resolveSymbolicLinks();
fail();
} catch (IOException e) {
- assertThat(e).hasMessage(link1 + " (Too many levels of symbolic links)");
+ assertThat(e).hasMessageThat().isEqualTo(link1 + " (Too many levels of symbolic links)");
}
}
}
@@ -299,7 +299,7 @@
xDanglingLink.resolveSymbolicLinks();
fail();
} catch (IOException e) {
- assertThat(e).hasMessage(xNothing + " (No such file or directory)");
+ assertThat(e).hasMessageThat().isEqualTo(xNothing + " (No such file or directory)");
}
}
}
@@ -354,14 +354,14 @@
xFile.readSymbolicLink(); // not a link
fail();
} catch (NotASymlinkException e) {
- assertThat(e).hasMessage(xFile.toString());
+ assertThat(e).hasMessageThat().isEqualTo(xFile.toString());
}
try {
xNothing.readSymbolicLink(); // nothing there
fail();
} catch (IOException e) {
- assertThat(e).hasMessage(xNothing + " (No such file or directory)");
+ assertThat(e).hasMessageThat().isEqualTo(xNothing + " (No such file or directory)");
}
}
@@ -375,7 +375,7 @@
xChildOfReadonlyDir.createSymbolicLink(xNothing);
fail();
} catch (IOException e) {
- assertThat(e).hasMessage(xChildOfReadonlyDir + " (Permission denied)");
+ assertThat(e).hasMessageThat().isEqualTo(xChildOfReadonlyDir + " (Permission denied)");
}
}
}
@@ -396,7 +396,9 @@
try {
someLink.resolveSymbolicLinks();
} catch (FileNotFoundException e) {
- assertThat(e).hasMessage(newPath.getParentDirectory() + " (No such file or directory)");
+ assertThat(e)
+ .hasMessageThat()
+ .isEqualTo(newPath.getParentDirectory() + " (No such file or directory)");
}
}
}
@@ -426,7 +428,7 @@
createSymbolicLink(xEmptyDirectory, xFile);
fail();
} catch (IOException e) { // => couldn't be created
- assertThat(e).hasMessage(xEmptyDirectory + " (File exists)");
+ assertThat(e).hasMessageThat().isEqualTo(xEmptyDirectory + " (File exists)");
}
assertThat(xEmptyDirectory.isDirectory(Symlinks.NOFOLLOW)).isTrue();
}
@@ -437,7 +439,7 @@
createSymbolicLink(xFile, xEmptyDirectory);
fail();
} catch (IOException e) { // => couldn't be created
- assertThat(e).hasMessage(xFile + " (File exists)");
+ assertThat(e).hasMessageThat().isEqualTo(xFile + " (File exists)");
}
assertThat(xFile.isFile(Symlinks.NOFOLLOW)).isTrue();
}
@@ -448,7 +450,7 @@
createSymbolicLink(xDanglingLink, xFile);
fail();
} catch (IOException e) {
- assertThat(e).hasMessage(xDanglingLink + " (File exists)");
+ assertThat(e).hasMessageThat().isEqualTo(xDanglingLink + " (File exists)");
}
assertThat(xDanglingLink.isSymbolicLink()).isTrue(); // still a symbolic link
assertThat(xDanglingLink.isDirectory()).isFalse(); // link still dangles
@@ -460,7 +462,7 @@
createSymbolicLink(xLinkToDirectory, xNothing);
fail();
} catch (IOException e) {
- assertThat(e).hasMessage(xLinkToDirectory + " (File exists)");
+ assertThat(e).hasMessageThat().isEqualTo(xLinkToDirectory + " (File exists)");
}
assertThat(xLinkToDirectory.isSymbolicLink()).isTrue(); // still a symbolic link
assertThat(xLinkToDirectory.isDirectory()).isTrue(); // link still points to dir
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystemTest.java b/src/test/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystemTest.java
index dcea0b7..5e920f9 100644
--- a/src/test/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystemTest.java
+++ b/src/test/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystemTest.java
@@ -398,7 +398,7 @@
a.stat();
fail("Expected IOException");
} catch (IOException e) {
- assertThat(e).hasMessage(aName + " (Too many levels of symbolic links)");
+ assertThat(e).hasMessageThat().isEqualTo(aName + " (Too many levels of symbolic links)");
}
}
@@ -413,7 +413,7 @@
a.stat();
fail("Expected IOException");
} catch (IOException e) {
- assertThat(e).hasMessage(aName + " (Too many levels of symbolic links)");
+ assertThat(e).hasMessageThat().isEqualTo(aName + " (Too many levels of symbolic links)");
}
}
}
diff --git a/src/test/java/com/google/devtools/build/skyframe/EmptySkyValueTest.java b/src/test/java/com/google/devtools/build/skyframe/EmptySkyValueTest.java
index 6123917..49a763e 100644
--- a/src/test/java/com/google/devtools/build/skyframe/EmptySkyValueTest.java
+++ b/src/test/java/com/google/devtools/build/skyframe/EmptySkyValueTest.java
@@ -16,13 +16,12 @@
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
/** Tests for {@link EmptySkyValue}. */
@RunWith(JUnit4.class)
@@ -36,7 +35,7 @@
objOut.writeObject(EmptySkyValue.INSTANCE);
fail("Expected exception");
} catch (UnsupportedOperationException e) {
- assertThat(e).hasMessage("Java serialization not supported");
+ assertThat(e).hasMessageThat().isEqualTo("Java serialization not supported");
}
}
diff --git a/src/test/java/com/google/devtools/build/skyframe/ErrorInfoTest.java b/src/test/java/com/google/devtools/build/skyframe/ErrorInfoTest.java
index 9c9d00e..a6eafa3 100644
--- a/src/test/java/com/google/devtools/build/skyframe/ErrorInfoTest.java
+++ b/src/test/java/com/google/devtools/build/skyframe/ErrorInfoTest.java
@@ -161,7 +161,8 @@
} catch (IllegalStateException e) {
// Brittle, but confirms we failed for the right reason.
assertThat(e)
- .hasMessage("At least one of exception and cycles must be non-null/empty, respectively");
+ .hasMessageThat()
+ .isEqualTo("At least one of exception and cycles must be non-null/empty, respectively");
}
}
diff --git a/src/test/java/com/google/devtools/build/skyframe/ErrorTransienceValueTest.java b/src/test/java/com/google/devtools/build/skyframe/ErrorTransienceValueTest.java
index 868d691..7439a25 100644
--- a/src/test/java/com/google/devtools/build/skyframe/ErrorTransienceValueTest.java
+++ b/src/test/java/com/google/devtools/build/skyframe/ErrorTransienceValueTest.java
@@ -16,13 +16,12 @@
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
/** Tests for {@link ErrorTransienceValue}. */
@RunWith(JUnit4.class)
@@ -36,7 +35,7 @@
objOut.writeObject(ErrorTransienceValue.INSTANCE);
fail("Expected exception");
} catch (UnsupportedOperationException e) {
- assertThat(e).hasMessage("Java serialization not supported");
+ assertThat(e).hasMessageThat().isEqualTo("Java serialization not supported");
}
}
diff --git a/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java b/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java
index b163489..200cf3b 100644
--- a/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java
+++ b/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java
@@ -1362,7 +1362,9 @@
} else {
assertThatErrorInfo(errorInfo).isNotTransient();
}
- assertThat(errorInfo.getException()).hasMessage(NODE_TYPE.getName() + ":errorKey");
+ assertThat(errorInfo.getException())
+ .hasMessageThat()
+ .isEqualTo(NODE_TYPE.getName() + ":errorKey");
assertThat(errorInfo.getRootCauseOfException()).isEqualTo(errorKey);
} else {
// When errors are not stored alongside values, transient errors that are recovered from do