summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2024-04-29 00:55:54 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2024-04-29 15:20:41 +0200
commit07e77293b1e84fddfdc5edbb378021a93427c971 (patch)
treef8eb616a8ed6da85de4944ab903bfb9499c9b03e
parent1d253988076e8848b8e30141229624cfc7b62c06 (diff)
downloadjgit-07e77293b1e84fddfdc5edbb378021a93427c971.tar.gz
jgit-07e77293b1e84fddfdc5edbb378021a93427c971.zip
[errorprone] Fix pattern UseCorrectAssertInTests
See https://errorprone.info/bugpattern/UseCorrectAssertInTests Change-Id: Iffde63ac795ad30c3e7774764cb8189cb089ed86
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java8
-rw-r--r--tools/BUILD2
2 files changed, 6 insertions, 4 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
index 3b0e184a42..1c2e995bbb 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java
@@ -14,6 +14,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import static org.eclipse.jgit.util.FileUtils.RECURSIVE;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
@@ -879,7 +880,7 @@ public class AddCommandTest extends RepositoryTestCase {
}
}
// Help null pointer analysis.
- assert lastFile != null;
+ assertNotNull(lastFile);
// Wait a bit. If entries are "racily clean", we'll recompute
// hashes from the disk files, and then the second add is also slow.
// We want to test the normal case.
@@ -1260,7 +1261,7 @@ public class AddCommandTest extends RepositoryTestCase {
"[git-link-dir, mode:160000]",
indexState(0));
Set<String> untrackedFiles = git.status().call().getUntracked();
- assert untrackedFiles.isEmpty();
+ assertTrue(untrackedFiles.isEmpty());
}
}
@@ -1275,7 +1276,8 @@ public class AddCommandTest extends RepositoryTestCase {
ConfigConstants.CONFIG_KEY_DIRNOGITLINKS, true);
config.save();
- assert db.getConfig().get(WorkingTreeOptions.KEY).isDirNoGitLinks();
+ assertTrue(
+ db.getConfig().get(WorkingTreeOptions.KEY).isDirNoGitLinks());
try (Git git = new Git(db)) {
git.add().addFilepattern("nested-repo").call();
diff --git a/tools/BUILD b/tools/BUILD
index 9cb24aa361..546ca34b1a 100644
--- a/tools/BUILD
+++ b/tools/BUILD
@@ -410,7 +410,7 @@ java_package_configuration(
"-Xep:UnusedVariable:ERROR",
"-Xep:URLEqualsHashCode:ERROR",
"-Xep:UseBinds:ERROR",
- "-Xep:UseCorrectAssertInTests:WARN",
+ "-Xep:UseCorrectAssertInTests:ERROR",
"-Xep:VariableNameSameAsType:ERROR",
"-Xep:VarTypeName:ERROR",
"-Xep:WaitNotInLoop:ERROR",