diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java index 1686ce1fa..2c1eb768b 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java @@ -149,7 +149,7 @@ public class PullCommandWithRebaseTest extends RepositoryTestCase { PullResult res = target.pull().call(); // nothing to update since we don't have different data yet assertTrue(res.getFetchResult().getTrackingRefUpdates().isEmpty()); - assertTrue(res.getRebaseResult().getStatus().equals(Status.UP_TO_DATE)); + assertEquals(Status.UP_TO_DATE, res.getRebaseResult().getStatus()); assertFileContentsEqual(targetFile, "Hello world"); @@ -172,7 +172,7 @@ public class PullCommandWithRebaseTest extends RepositoryTestCase { ConfigConstants.CONFIG_KEY_URL); assertFalse(res.getFetchResult().getTrackingRefUpdates().isEmpty()); - assertTrue(res.getRebaseResult().getStatus().equals(Status.STOPPED)); + assertEquals(Status.STOPPED, res.getRebaseResult().getStatus()); String result = "<<<<<<< Upstream, based on branch 'master' of " + remoteUri + "\nSource change\n=======\nTarget change\n>>>>>>> 42453fd Target change in local\n"; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ResetCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ResetCommandTest.java index c55775c9f..8f2e54388 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ResetCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ResetCommandTest.java @@ -141,7 +141,7 @@ public class ResetCommandTest extends RepositoryTestCase { .call(); // check if HEAD points to initial commit now ObjectId head = db.resolve(Constants.HEAD); - assertTrue(head.equals(initialCommit)); + assertEquals(initialCommit, head); // check if files were removed assertFalse(indexFile.exists()); assertTrue(untrackedFile.exists()); @@ -178,7 +178,7 @@ public class ResetCommandTest extends RepositoryTestCase { .call(); // check if HEAD points to initial commit now ObjectId head = db.resolve(Constants.HEAD); - assertTrue(head.equals(initialCommit)); + assertEquals(initialCommit, head); // check if files still exist assertTrue(untrackedFile.exists()); assertTrue(indexFile.exists()); @@ -199,7 +199,7 @@ public class ResetCommandTest extends RepositoryTestCase { .call(); // check if HEAD points to initial commit now ObjectId head = db.resolve(Constants.HEAD); - assertTrue(head.equals(initialCommit)); + assertEquals(initialCommit, head); // check if files still exist assertTrue(untrackedFile.exists()); assertTrue(indexFile.exists()); @@ -277,7 +277,7 @@ public class ResetCommandTest extends RepositoryTestCase { // check that HEAD hasn't moved ObjectId head = db.resolve(Constants.HEAD); - assertTrue(head.equals(secondCommit)); + assertEquals(secondCommit, head); // check if files still exist assertTrue(untrackedFile.exists()); assertTrue(indexFile.exists()); @@ -306,7 +306,7 @@ public class ResetCommandTest extends RepositoryTestCase { // check that HEAD hasn't moved ObjectId head = db.resolve(Constants.HEAD); - assertTrue(head.equals(secondCommit)); + assertEquals(secondCommit, head); // check if files still exist assertTrue(untrackedFile.exists()); assertTrue(inHead("dir/b.txt")); @@ -332,7 +332,7 @@ public class ResetCommandTest extends RepositoryTestCase { // check that HEAD hasn't moved ObjectId head = db.resolve(Constants.HEAD); - assertTrue(head.equals(secondCommit)); + assertEquals(secondCommit, head); // check if files still exist assertTrue(untrackedFile.exists()); assertTrue(indexFile.exists()); @@ -357,7 +357,7 @@ public class ResetCommandTest extends RepositoryTestCase { git.reset().setRef(tagName).setMode(HARD).call(); ObjectId head = db.resolve(Constants.HEAD); - assertTrue(head.equals(secondCommit)); + assertEquals(secondCommit, head); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashCreateCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashCreateCommandTest.java index 16fadef15..2b01b60cb 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashCreateCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashCreateCommandTest.java @@ -291,7 +291,7 @@ public class StashCreateCommandTest extends RepositoryTestCase { assertEquals("content", read(committedFile)); validateStashedCommit(stashed); - assertTrue(stashed.getTree().equals(stashed.getParent(1).getTree())); + assertEquals(stashed.getParent(1).getTree(), stashed.getTree()); List workingDiffs = diffWorkingAgainstHead(stashed); assertEquals(1, workingDiffs.size()); @@ -326,7 +326,7 @@ public class StashCreateCommandTest extends RepositoryTestCase { validateStashedCommit(stashed); - assertTrue(stashed.getTree().equals(stashed.getParent(1).getTree())); + assertEquals(stashed.getParent(1).getTree(), stashed.getTree()); List workingDiffs = diffWorkingAgainstHead(stashed); assertEquals(1, workingDiffs.size()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/EditListTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/EditListTest.java index 30f32098a..d6a5dcde2 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/EditListTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/EditListTest.java @@ -60,8 +60,8 @@ public class EditListTest { assertTrue(l.isEmpty()); assertEquals("EditList[]", l.toString()); - assertTrue(l.equals(l)); - assertTrue(l.equals(new EditList())); + assertEquals(l, l); + assertEquals(new EditList(), l); assertFalse(l.equals("")); assertEquals(l.hashCode(), new EditList().hashCode()); } @@ -76,13 +76,13 @@ public class EditListTest { assertSame(e, l.get(0)); assertSame(e, l.iterator().next()); - assertTrue(l.equals(l)); + assertEquals(l, l); assertFalse(l.equals(new EditList())); final EditList l2 = new EditList(); l2.add(e); - assertTrue(l.equals(l2)); - assertTrue(l2.equals(l)); + assertEquals(l2, l); + assertEquals(l, l2); assertEquals(l.hashCode(), l2.hashCode()); } @@ -101,14 +101,14 @@ public class EditListTest { assertSame(e1, i.next()); assertSame(e2, i.next()); - assertTrue(l.equals(l)); + assertEquals(l, l); assertFalse(l.equals(new EditList())); final EditList l2 = new EditList(); l2.add(e1); l2.add(e2); - assertTrue(l.equals(l2)); - assertTrue(l2.equals(l)); + assertEquals(l2, l); + assertEquals(l, l2); assertEquals(l.hashCode(), l2.hashCode()); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/EditTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/EditTest.java index a9cb2fbdd..1a0c39ebf 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/EditTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/EditTest.java @@ -130,9 +130,9 @@ public class EditTest { final Edit e1 = new Edit(1, 2, 3, 4); final Edit e2 = new Edit(1, 2, 3, 4); - assertTrue(e1.equals(e1)); - assertTrue(e1.equals(e2)); - assertTrue(e2.equals(e1)); + assertEquals(e1, e1); + assertEquals(e2, e1); + assertEquals(e1, e2); assertEquals(e1.hashCode(), e2.hashCode()); assertFalse(e1.equals("")); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/AbbreviatedObjectIdTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/AbbreviatedObjectIdTest.java index fc53f95b9..6529d9ed5 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/AbbreviatedObjectIdTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/AbbreviatedObjectIdTest.java @@ -221,8 +221,8 @@ public class AbbreviatedObjectIdTest { final AbbreviatedObjectId b = AbbreviatedObjectId.fromString(s); assertNotSame(a, b); assertTrue(a.hashCode() == b.hashCode()); - assertTrue(a.equals(b)); - assertTrue(b.equals(a)); + assertEquals(b, a); + assertEquals(a, b); } @Test @@ -232,8 +232,8 @@ public class AbbreviatedObjectIdTest { final AbbreviatedObjectId b = AbbreviatedObjectId.fromString(s); assertNotSame(a, b); assertTrue(a.hashCode() == b.hashCode()); - assertTrue(a.equals(b)); - assertTrue(b.equals(a)); + assertEquals(b, a); + assertEquals(a, b); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java index 23647f06d..3142995f2 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java @@ -935,7 +935,7 @@ public class DirCacheCheckoutTest extends RepositoryTestCase { } catch (CheckoutConflictException e) { assertIndex(mk("foo")); assertWorkDir(mkmap("foo", "different")); - assertTrue(getConflicts().equals(Arrays.asList("foo"))); + assertEquals(Arrays.asList("foo"), getConflicts()); assertTrue(new File(trash, "foo").isFile()); } } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdTest.java index cdcb43322..abf57d6cd 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdTest.java @@ -72,7 +72,7 @@ public class ObjectIdTest { final ObjectId a = ObjectId.fromString(x); final ObjectId b = ObjectId.fromString(x); assertEquals(a.hashCode(), b.hashCode()); - assertTrue("a and b are same", a.equals(b)); + assertEquals("a and b are same", b, a); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/ResolveMergerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/ResolveMergerTest.java index 9876100ec..30e046ea5 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/ResolveMergerTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/ResolveMergerTest.java @@ -131,7 +131,7 @@ public class ResolveMergerTest extends RepositoryTestCase { git.rm().addFilepattern("d/1").call(); git.rm().addFilepattern("d").call(); MergeResult mergeRes = git.merge().include(masterCommit).call(); - assertTrue(MergeStatus.CONFLICTING.equals(mergeRes.getMergeStatus())); + assertEquals(MergeStatus.CONFLICTING, mergeRes.getMergeStatus()); assertEquals( "[d/1, mode:100644, stage:1, content:orig][d/1, mode:100644, stage:2, content:side][d/1, mode:100644, stage:3, content:master]", indexState(CONTENT)); @@ -163,7 +163,7 @@ public class ResolveMergerTest extends RepositoryTestCase { git.rm().addFilepattern("d/1").call(); git.rm().addFilepattern("d").call(); MergeResult mergeRes = git.merge().include(masterCommit).call(); - assertTrue(MergeStatus.MERGED.equals(mergeRes.getMergeStatus())); + assertEquals(MergeStatus.MERGED, mergeRes.getMergeStatus()); assertEquals("[d/1, mode:100644, content:1master\n2\n3side\n]", indexState(CONTENT)); } @@ -194,7 +194,7 @@ public class ResolveMergerTest extends RepositoryTestCase { git.rm().addFilepattern("d/1").call(); git.rm().addFilepattern("d").call(); MergeResult mergeRes = git.merge().include(masterCommit).call(); - assertTrue(MergeStatus.MERGED.equals(mergeRes.getMergeStatus())); + assertEquals(MergeStatus.MERGED, mergeRes.getMergeStatus()); assertEquals("[d/1, mode:100644, content:modified]", indexState(CONTENT)); } @@ -260,7 +260,7 @@ public class ResolveMergerTest extends RepositoryTestCase { git.rm().addFilepattern("d/1").call(); git.rm().addFilepattern("d").call(); MergeResult mergeRes = git.merge().include(masterCommit).call(); - assertTrue(MergeStatus.MERGED.equals(mergeRes.getMergeStatus())); + assertEquals(MergeStatus.MERGED, mergeRes.getMergeStatus()); assertEquals( "[2, mode:100644, content:orig][d/1, mode:100644, content:orig]", indexState(CONTENT)); @@ -294,7 +294,7 @@ public class ResolveMergerTest extends RepositoryTestCase { git.rm().addFilepattern("d/1").call(); git.rm().addFilepattern("d").call(); MergeResult mergeRes = git.merge().include(masterCommit).call(); - assertTrue(MergeStatus.CONFLICTING.equals(mergeRes.getMergeStatus())); + assertEquals(MergeStatus.CONFLICTING, mergeRes.getMergeStatus()); assertEquals( "[2, mode:100644, content:orig][d/1, mode:100644, stage:2, content:side][d/1, mode:100644, stage:3, content:master]", indexState(CONTENT)); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevFlagSetTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevFlagSetTest.java index 021795eef..95860d63f 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevFlagSetTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevFlagSetTest.java @@ -120,7 +120,7 @@ public class RevFlagSetTest extends RevWalkTestCase { assertTrue(set.add(flag1)); assertTrue(set.add(flag2)); - assertTrue(new RevFlagSet(set).equals(set)); + assertEquals(set, new RevFlagSet(set)); assertTrue(new RevFlagSet(Arrays.asList(new RevFlag[] { flag1, flag2 })) .equals(set)); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java index cbdf23641..e92bca6d5 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java @@ -639,7 +639,7 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { ObjectId rb = db.resolve("refs/heads/b"); writeSymref(Constants.HEAD, "refs/heads/b"); ObjectId oldHead = db.resolve(Constants.HEAD); - assertTrue("internal test condition, b == HEAD", rb.equals(oldHead)); + assertEquals("internal test condition, b == HEAD", oldHead, rb); writeReflog(db, rb, "Just a message", "refs/heads/b"); assertTrue("log on old branch", new File(db.getDirectory(), "logs/refs/heads/b").exists()); @@ -804,7 +804,7 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { updateRef.setRefLogMessage("Setup", false); assertEquals(Result.FAST_FORWARD, updateRef.update()); ObjectId oldHead = db.resolve(Constants.HEAD); - assertTrue(rb.equals(oldHead)); // assumption for this test + assertEquals(oldHead, rb); // assumption for this test writeReflog(db, rb, "Just a message", "refs/heads/a"); assertTrue("internal check, we have a log", new File(db.getDirectory(), "logs/refs/heads/a").exists()); @@ -838,7 +838,7 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { updateRef.setForceUpdate(true); assertEquals(Result.FORCED, updateRef.update()); ObjectId oldHead = db.resolve(Constants.HEAD); - assertTrue(rb.equals(oldHead)); // assumption for this test + assertEquals(oldHead, rb); // assumption for this test writeReflog(db, rb, "Just a message", "refs/heads/prefix/a"); assertTrue("internal check, we have a log", new File(db.getDirectory(), "logs/refs/heads/prefix/a").exists()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineInTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineInTest.java index 6f930d737..13fc68d8c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineInTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PacketLineInTest.java @@ -46,7 +46,6 @@ package org.eclipse.jgit.transport; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.ByteArrayInputStream; @@ -221,7 +220,7 @@ public class PacketLineInTest { init("0008NAK\n"); assertSame(PacketLineIn.AckNackResult.NAK, in.readACK(actid)); - assertTrue(actid.equals(expid)); + assertEquals(expid, actid); assertEOF(); } @@ -233,7 +232,7 @@ public class PacketLineInTest { init("0031ACK fcfcfb1fd94829c1a1704f894fc111d14770d34e\n"); assertSame(PacketLineIn.AckNackResult.ACK, in.readACK(actid)); - assertTrue(actid.equals(expid)); + assertEquals(expid, actid); assertEOF(); } @@ -245,7 +244,7 @@ public class PacketLineInTest { init("003aACK fcfcfb1fd94829c1a1704f894fc111d14770d34e continue\n"); assertSame(PacketLineIn.AckNackResult.ACK_CONTINUE, in.readACK(actid)); - assertTrue(actid.equals(expid)); + assertEquals(expid, actid); assertEOF(); } @@ -257,7 +256,7 @@ public class PacketLineInTest { init("0038ACK fcfcfb1fd94829c1a1704f894fc111d14770d34e common\n"); assertSame(PacketLineIn.AckNackResult.ACK_COMMON, in.readACK(actid)); - assertTrue(actid.equals(expid)); + assertEquals(expid, actid); assertEOF(); } @@ -269,7 +268,7 @@ public class PacketLineInTest { init("0037ACK fcfcfb1fd94829c1a1704f894fc111d14770d34e ready\n"); assertSame(PacketLineIn.AckNackResult.ACK_READY, in.readACK(actid)); - assertTrue(actid.equals(expid)); + assertEquals(expid, actid); assertEOF(); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java index 40790a5b4..b43fe48be 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java @@ -454,7 +454,7 @@ public class RefMapTest { Map.Entry ent_b = itr.next(); assertEquals(ent_a.hashCode(), "A".hashCode()); - assertTrue(ent_a.equals(ent_a)); + assertEquals(ent_a, ent_a); assertFalse(ent_a.equals(ent_b)); assertEquals(a.toString(), ent_a.toString());