]> source.dussan.org Git - jgit.git/commitdiff
Use assertTrue/False instead of equals with boolean literals 69/7769/2
authorRobin Rosenberg <robin.rosenberg@dewire.com>
Fri, 14 Sep 2012 17:43:20 +0000 (19:43 +0200)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Sat, 15 Sep 2012 22:23:23 +0000 (00:23 +0200)
This include replacing assertTrue(!..) with assertFalse()

Change-Id: Idecd8018641454e10127d82ea3ddda3f671489ef

org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/fnmatch/FileNameMatcherTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackWriterTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/OpenSshConfigTest.java

index 07387e4fa6968ef5bf532b91d7ce32bdc8559bb4..c99762f976df3a43e7c66583f7b80d9b5d560453 100644 (file)
@@ -42,6 +42,7 @@
  */
 package org.eclipse.jgit.api;
 
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.util.Set;
@@ -111,7 +112,7 @@ public class CleanCommandTest extends RepositoryTestCase {
                files = status.getUntracked();
                assertTrue(files.size() == 1);
                assertTrue(cleanedFiles.contains("File3.txt"));
-               assertTrue(!cleanedFiles.contains("File2.txt"));
+               assertFalse(cleanedFiles.contains("File2.txt"));
        }
 
        @Test
index 66943c242e27d1638e1cb0f1d64aa2df49b0885f..3553fcf43cd3c5e5c337cf4cbe31a86f068d1cc5 100644 (file)
@@ -45,6 +45,7 @@
 package org.eclipse.jgit.fnmatch;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -829,22 +830,22 @@ public class FileNameMatcherTest {
                final String pattern = "helloworld";
                final FileNameMatcher matcher = new FileNameMatcher(pattern, null);
                matcher.append("helloworld");
-               assertEquals(true, matcher.isMatch());
-               assertEquals(false, matcher.canAppendMatch());
+               assertTrue(matcher.isMatch());
+               assertFalse(matcher.canAppendMatch());
                matcher.reset();
                matcher.append("hello");
-               assertEquals(false, matcher.isMatch());
-               assertEquals(true, matcher.canAppendMatch());
+               assertFalse(matcher.isMatch());
+               assertTrue(matcher.canAppendMatch());
                matcher.append("world");
-               assertEquals(true, matcher.isMatch());
-               assertEquals(false, matcher.canAppendMatch());
+               assertTrue(matcher.isMatch());
+               assertFalse(matcher.canAppendMatch());
                matcher.append("to much");
-               assertEquals(false, matcher.isMatch());
-               assertEquals(false, matcher.canAppendMatch());
+               assertFalse(matcher.isMatch());
+               assertFalse(matcher.canAppendMatch());
                matcher.reset();
                matcher.append("helloworld");
-               assertEquals(true, matcher.isMatch());
-               assertEquals(false, matcher.canAppendMatch());
+               assertTrue(matcher.isMatch());
+               assertFalse(matcher.canAppendMatch());
        }
 
        @Test
@@ -853,30 +854,30 @@ public class FileNameMatcherTest {
                final FileNameMatcher matcher = new FileNameMatcher(pattern, null);
                matcher.append("hello");
                final FileNameMatcher childMatcher = matcher.createMatcherForSuffix();
-               assertEquals(false, matcher.isMatch());
-               assertEquals(true, matcher.canAppendMatch());
-               assertEquals(false, childMatcher.isMatch());
-               assertEquals(true, childMatcher.canAppendMatch());
+               assertFalse(matcher.isMatch());
+               assertTrue(matcher.canAppendMatch());
+               assertFalse(childMatcher.isMatch());
+               assertTrue(childMatcher.canAppendMatch());
                matcher.append("world");
-               assertEquals(true, matcher.isMatch());
-               assertEquals(false, matcher.canAppendMatch());
-               assertEquals(false, childMatcher.isMatch());
-               assertEquals(true, childMatcher.canAppendMatch());
+               assertTrue(matcher.isMatch());
+               assertFalse(matcher.canAppendMatch());
+               assertFalse(childMatcher.isMatch());
+               assertTrue(childMatcher.canAppendMatch());
                childMatcher.append("world");
-               assertEquals(true, matcher.isMatch());
-               assertEquals(false, matcher.canAppendMatch());
-               assertEquals(true, childMatcher.isMatch());
-               assertEquals(false, childMatcher.canAppendMatch());
+               assertTrue(matcher.isMatch());
+               assertFalse(matcher.canAppendMatch());
+               assertTrue(childMatcher.isMatch());
+               assertFalse(childMatcher.canAppendMatch());
                childMatcher.reset();
-               assertEquals(true, matcher.isMatch());
-               assertEquals(false, matcher.canAppendMatch());
-               assertEquals(false, childMatcher.isMatch());
-               assertEquals(true, childMatcher.canAppendMatch());
+               assertTrue(matcher.isMatch());
+               assertFalse(matcher.canAppendMatch());
+               assertFalse(childMatcher.isMatch());
+               assertTrue(childMatcher.canAppendMatch());
                childMatcher.append("world");
-               assertEquals(true, matcher.isMatch());
-               assertEquals(false, matcher.canAppendMatch());
-               assertEquals(true, childMatcher.isMatch());
-               assertEquals(false, childMatcher.canAppendMatch());
+               assertTrue(matcher.isMatch());
+               assertFalse(matcher.canAppendMatch());
+               assertTrue(childMatcher.isMatch());
+               assertFalse(childMatcher.canAppendMatch());
        }
 
        @Test
@@ -885,29 +886,29 @@ public class FileNameMatcherTest {
                final FileNameMatcher matcher = new FileNameMatcher(pattern, null);
                matcher.append("hello");
                final FileNameMatcher copy = new FileNameMatcher(matcher);
-               assertEquals(false, matcher.isMatch());
-               assertEquals(true, matcher.canAppendMatch());
-               assertEquals(false, copy.isMatch());
-               assertEquals(true, copy.canAppendMatch());
+               assertFalse(matcher.isMatch());
+               assertTrue(matcher.canAppendMatch());
+               assertFalse(copy.isMatch());
+               assertTrue(copy.canAppendMatch());
                matcher.append("world");
-               assertEquals(true, matcher.isMatch());
-               assertEquals(false, matcher.canAppendMatch());
-               assertEquals(false, copy.isMatch());
-               assertEquals(true, copy.canAppendMatch());
+               assertTrue(matcher.isMatch());
+               assertFalse(matcher.canAppendMatch());
+               assertFalse(copy.isMatch());
+               assertTrue(copy.canAppendMatch());
                copy.append("world");
-               assertEquals(true, matcher.isMatch());
-               assertEquals(false, matcher.canAppendMatch());
-               assertEquals(true, copy.isMatch());
-               assertEquals(false, copy.canAppendMatch());
+               assertTrue(matcher.isMatch());
+               assertFalse(matcher.canAppendMatch());
+               assertTrue(copy.isMatch());
+               assertFalse(copy.canAppendMatch());
                copy.reset();
-               assertEquals(true, matcher.isMatch());
-               assertEquals(false, matcher.canAppendMatch());
-               assertEquals(false, copy.isMatch());
-               assertEquals(true, copy.canAppendMatch());
+               assertTrue(matcher.isMatch());
+               assertFalse(matcher.canAppendMatch());
+               assertFalse(copy.isMatch());
+               assertTrue(copy.canAppendMatch());
                copy.append("helloworld");
-               assertEquals(true, matcher.isMatch());
-               assertEquals(false, matcher.canAppendMatch());
-               assertEquals(true, copy.isMatch());
-               assertEquals(false, copy.canAppendMatch());
+               assertTrue(matcher.isMatch());
+               assertFalse(matcher.canAppendMatch());
+               assertTrue(copy.isMatch());
+               assertFalse(copy.canAppendMatch());
        }
 }
index 965a21ce054219d6e82793d846d24a7ec50dc3b5..f262d01ea9e226795d18e41f92888c22f116e70d 100644 (file)
@@ -44,6 +44,7 @@
 package org.eclipse.jgit.storage.file;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -134,9 +135,9 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
        @Test
        public void testContructor() throws IOException {
                writer = new PackWriter(config, db.newObjectReader());
-               assertEquals(false, writer.isDeltaBaseAsOffset());
-               assertEquals(true, config.isReuseDeltas());
-               assertEquals(true, config.isReuseObjects());
+               assertFalse(writer.isDeltaBaseAsOffset());
+               assertTrue(config.isReuseDeltas());
+               assertTrue(config.isReuseObjects());
                assertEquals(0, writer.getObjectCount());
        }
 
@@ -148,14 +149,14 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
                config.setReuseDeltas(false);
                config.setReuseObjects(false);
                config.setDeltaBaseAsOffset(false);
-               assertEquals(false, config.isReuseDeltas());
-               assertEquals(false, config.isReuseObjects());
-               assertEquals(false, config.isDeltaBaseAsOffset());
+               assertFalse(config.isReuseDeltas());
+               assertFalse(config.isReuseObjects());
+               assertFalse(config.isDeltaBaseAsOffset());
 
                writer = new PackWriter(config, db.newObjectReader());
                writer.setDeltaBaseAsOffset(true);
-               assertEquals(true, writer.isDeltaBaseAsOffset());
-               assertEquals(false, config.isDeltaBaseAsOffset());
+               assertTrue(writer.isDeltaBaseAsOffset());
+               assertFalse(config.isDeltaBaseAsOffset());
        }
 
        /**
index c079234593e07ded5703e53d085b2d9a2896d74d..cb527c171216ab9738d615b4921977c058295272 100644 (file)
 package org.eclipse.jgit.transport;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -228,7 +230,7 @@ public class OpenSshConfigTest extends RepositoryTestCase {
        public void testAlias_BatchModeDefault() throws Exception {
                final Host h = osc.lookup("orcz");
                assertNotNull(h);
-               assertEquals(false, h.isBatchMode());
+               assertFalse(h.isBatchMode());
        }
 
        @Test
@@ -236,7 +238,7 @@ public class OpenSshConfigTest extends RepositoryTestCase {
                config("Host orcz\n" + "\tBatchMode yes\n");
                final Host h = osc.lookup("orcz");
                assertNotNull(h);
-               assertEquals(true, h.isBatchMode());
+               assertTrue(h.isBatchMode());
        }
 
        @Test
@@ -245,6 +247,6 @@ public class OpenSshConfigTest extends RepositoryTestCase {
                                + "\tBatchMode yes\n");
                final Host h = osc.lookup("orcz");
                assertNotNull(h);
-               assertEquals(true, h.isBatchMode());
+               assertTrue(h.isBatchMode());
        }
 }