]> source.dussan.org Git - jgit.git/commitdiff
Use assertEquals instead of == for literal primitives 70/7770/3
authorRobin Rosenberg <robin.rosenberg@dewire.com>
Fri, 14 Sep 2012 22:47:06 +0000 (00:47 +0200)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Sat, 15 Sep 2012 22:23:51 +0000 (00:23 +0200)
Change-Id: I8449695ecc94a423369a7644a6ec93cf0cacef5d

org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitAndLogCommandTests.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/NotesCommandTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0002_TreeTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevFlagSetTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_BasicTest.java

index c99762f976df3a43e7c66583f7b80d9b5d560453..5ded3bce122ab046dbab1d121a68be7c9703d950 100644 (file)
@@ -42,6 +42,7 @@
  */
 package org.eclipse.jgit.api;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
@@ -89,7 +90,7 @@ public class CleanCommandTest extends RepositoryTestCase {
                status = git.status().call();
                files = status.getUntracked();
 
-               assertTrue(files.size() == 0);
+               assertEquals(0, files.size());
                assertTrue(cleanedFiles.contains("File2.txt"));
                assertTrue(cleanedFiles.contains("File3.txt"));
        }
@@ -110,7 +111,7 @@ public class CleanCommandTest extends RepositoryTestCase {
 
                status = git.status().call();
                files = status.getUntracked();
-               assertTrue(files.size() == 1);
+               assertEquals(1, files.size());
                assertTrue(cleanedFiles.contains("File3.txt"));
                assertFalse(cleanedFiles.contains("File2.txt"));
        }
@@ -130,7 +131,7 @@ public class CleanCommandTest extends RepositoryTestCase {
                status = git.status().call();
                files = status.getUntracked();
 
-               assertTrue(files.size() == 2);
+               assertEquals(2, files.size());
                assertTrue(cleanedFiles.contains("File2.txt"));
                assertTrue(cleanedFiles.contains("File3.txt"));
        }
index 6424f1c5d3b02250bfa46a0ebfc134b40fe5eb94..2eaec1476f3a8b9ef04dd3237a41863848a3cc87 100644 (file)
@@ -220,7 +220,7 @@ public class CommitAndLogCommandTests extends RepositoryTestCase {
                RevCommit[] parents = commit.getParents();
                assertEquals(parents[0], firstSide);
                assertEquals(parents[1], second);
-               assertTrue(parents.length==2);
+               assertEquals(2, parents.length);
        }
 
        @Test
index 9effe6022dd854b695c9ee43de0cabfb3414962f..21ac3ad4eb62feac06dc68929ead8c9a50accbe2 100644 (file)
@@ -461,7 +461,7 @@ public class MergeCommandTest extends RepositoryTestCase {
 
                assertEquals(null, result.getConflicts());
 
-               assertTrue(2 == result.getMergedCommits().length);
+               assertEquals(2, result.getMergedCommits().length);
                assertEquals(thirdCommit, result.getMergedCommits()[0]);
                assertEquals(secondCommit, result.getMergedCommits()[1]);
 
@@ -523,7 +523,7 @@ public class MergeCommandTest extends RepositoryTestCase {
 
                assertEquals(null, result.getConflicts());
 
-               assertTrue(2 == result.getMergedCommits().length);
+               assertEquals(2, result.getMergedCommits().length);
                assertEquals(thirdCommit, result.getMergedCommits()[0]);
                assertEquals(secondCommit, result.getMergedCommits()[1]);
 
index cb34c0e87c7a2eb68b48ca4139f03bfdeac38703..5afb1e8800b28fed74a232fed7eca3803e8b4705 100644 (file)
@@ -43,8 +43,6 @@
 package org.eclipse.jgit.api;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 import java.util.List;
 
 import org.eclipse.jgit.lib.RepositoryTestCase;
@@ -80,7 +78,7 @@ public class NotesCommandTest extends RepositoryTestCase {
        @Test
        public void testListNotes() throws Exception {
                List<Note> notes = git.notesList().call();
-               assertTrue(notes.size() == 1);
+               assertEquals(1, notes.size());
        }
 
        @Test
@@ -94,7 +92,7 @@ public class NotesCommandTest extends RepositoryTestCase {
                git.notesRemove().setObjectId(commit2).call();
 
                List<Note> notes = git.notesList().call();
-               assertTrue(notes.size() == 1);
+               assertEquals(1, notes.size());
        }
 
 }
index 8027f980d666e788f9ccf4fd1210340f123e5aa8..dd7d335c8164a822bc9b6a0892e51c1157094be6 100644 (file)
@@ -123,7 +123,7 @@ public class T0002_TreeTest extends SampleDataRepositoryTestCase {
                assertTrue("no name", t.getName() == null);
                assertTrue("no nameUTF8", t.getNameUTF8() == null);
                assertTrue("has entries array", t.members() != null);
-               assertTrue("entries is empty", t.members().length == 0);
+               assertEquals("entries is empty", 0, t.members().length);
                assertEquals("full name is empty", "", t.getFullName());
                assertTrue("no id", t.getId() == null);
                assertTrue("database is r", t.getRepository() == db);
@@ -184,7 +184,7 @@ public class T0002_TreeTest extends SampleDataRepositoryTestCase {
                final TreeEntry[] i = t.members();
                assertTrue("iterator is not empty", i.length > 0);
                assertTrue("iterator returns file", i[0] == f);
-               assertTrue("iterator is empty", i.length == 1);
+               assertEquals("iterator is empty", 1, i.length);
        }
 
        @Test
index 95860d63f6c0de1ab0a78848b666e2d1befe1b9e..1eebb5002d867668b1f1daeb5ded4fb32137d79e 100644 (file)
@@ -86,7 +86,7 @@ public class RevFlagSetTest extends RevWalkTestCase {
        public void testAddTwo() {
                final RevFlag flag1 = rw.newFlag("flag_1");
                final RevFlag flag2 = rw.newFlag("flag_2");
-               assertTrue((flag1.mask & flag2.mask) == 0);
+               assertEquals(0, (flag1.mask & flag2.mask));
 
                final RevFlagSet set = new RevFlagSet();
                assertTrue(set.add(flag1));
index 2a9bb7a56eb134d0a14737768d399ad734b1c999..12c634909f70269657f3121a102e9d8c61033e6d 100644 (file)
@@ -399,7 +399,7 @@ public class T0003_BasicTest extends SampleDataRepositoryTestCase {
                try {
                        assertEquals(0x78, xis.readUInt8());
                        assertEquals(0x9c, xis.readUInt8());
-                       assertTrue(0x789c % 31 == 0);
+                       assertEquals(0, 0x789c % 31);
                } finally {
                        xis.close();
                }