From 6a4c77e619d79c885aa6f08f2a1d8d8c1a936bcb Mon Sep 17 00:00:00 2001 From: Carsten Hammer Date: Thu, 11 Apr 2019 19:27:34 +0200 Subject: Use isEmpty() instead of size()==0 where possible Change-Id: I97f1367a2ea9f1f6146e264c27c3981b842f2a26 Signed-off-by: Carsten Hammer Signed-off-by: Matthias Sohn --- .../tst/org/eclipse/jgit/api/CleanCommandTest.java | 2 +- .../tst/org/eclipse/jgit/lib/ReflogConfigTest.java | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'org.eclipse.jgit.test') diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java index 139f199f7a..4eeaf4d6e4 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java @@ -128,7 +128,7 @@ public class CleanCommandTest extends RepositoryTestCase { status = git.status().call(); files = status.getUntracked(); - assertTrue(files.size() == 0); + assertTrue(files.isEmpty()); assertTrue(cleanedFiles.contains("File2.txt")); assertTrue(cleanedFiles.contains("File3.txt")); assertTrue(!cleanedFiles.contains("sub-noclean/File1.txt")); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java index df1a52dc09..f2f277c6ea 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ReflogConfigTest.java @@ -45,7 +45,6 @@ package org.eclipse.jgit.lib; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -63,7 +62,8 @@ public class ReflogConfigTest extends RepositoryTestCase { // check that there are no entries in the reflog and turn off writing // reflogs - assertEquals(0, db.getReflogReader(Constants.HEAD).getReverseEntries().size()); + assertTrue(db.getReflogReader(Constants.HEAD).getReverseEntries() + .isEmpty()); final FileBasedConfig cfg = db.getConfig(); cfg.setBoolean("core", null, "logallrefupdates", false); cfg.save(); @@ -72,9 +72,8 @@ public class ReflogConfigTest extends RepositoryTestCase { // written commit("A Commit\n", commitTime, tz); commitTime += 60 * 1000; - assertTrue( - "Reflog for HEAD still contain no entry", - db.getReflogReader(Constants.HEAD).getReverseEntries().size() == 0); + assertTrue("Reflog for HEAD still contain no entry", db + .getReflogReader(Constants.HEAD).getReverseEntries().isEmpty()); // set the logAllRefUpdates parameter to true and check it cfg.setBoolean("core", null, "logallrefupdates", true); -- cgit v1.2.3