Browse Source

Use assertTrue/False instead of equals with boolean literals

This include replacing assertTrue(!..) with assertFalse()

Change-Id: Idecd8018641454e10127d82ea3ddda3f671489ef
stable-2.2
Robin Rosenberg 12 years ago
parent
commit
a7b0641b96
  1. 3
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java
  2. 101
      org.eclipse.jgit.test/tst/org/eclipse/jgit/fnmatch/FileNameMatcherTest.java
  3. 17
      org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackWriterTest.java
  4. 8
      org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/OpenSshConfigTest.java

3
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java

@ -42,6 +42,7 @@
*/ */
package org.eclipse.jgit.api; package org.eclipse.jgit.api;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.util.Set; import java.util.Set;
@ -111,7 +112,7 @@ public class CleanCommandTest extends RepositoryTestCase {
files = status.getUntracked(); files = status.getUntracked();
assertTrue(files.size() == 1); assertTrue(files.size() == 1);
assertTrue(cleanedFiles.contains("File3.txt")); assertTrue(cleanedFiles.contains("File3.txt"));
assertTrue(!cleanedFiles.contains("File2.txt")); assertFalse(cleanedFiles.contains("File2.txt"));
} }
@Test @Test

101
org.eclipse.jgit.test/tst/org/eclipse/jgit/fnmatch/FileNameMatcherTest.java

@ -45,6 +45,7 @@
package org.eclipse.jgit.fnmatch; package org.eclipse.jgit.fnmatch;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
@ -829,22 +830,22 @@ public class FileNameMatcherTest {
final String pattern = "helloworld"; final String pattern = "helloworld";
final FileNameMatcher matcher = new FileNameMatcher(pattern, null); final FileNameMatcher matcher = new FileNameMatcher(pattern, null);
matcher.append("helloworld"); matcher.append("helloworld");
assertEquals(true, matcher.isMatch()); assertTrue(matcher.isMatch());
assertEquals(false, matcher.canAppendMatch()); assertFalse(matcher.canAppendMatch());
matcher.reset(); matcher.reset();
matcher.append("hello"); matcher.append("hello");
assertEquals(false, matcher.isMatch()); assertFalse(matcher.isMatch());
assertEquals(true, matcher.canAppendMatch()); assertTrue(matcher.canAppendMatch());
matcher.append("world"); matcher.append("world");
assertEquals(true, matcher.isMatch()); assertTrue(matcher.isMatch());
assertEquals(false, matcher.canAppendMatch()); assertFalse(matcher.canAppendMatch());
matcher.append("to much"); matcher.append("to much");
assertEquals(false, matcher.isMatch()); assertFalse(matcher.isMatch());
assertEquals(false, matcher.canAppendMatch()); assertFalse(matcher.canAppendMatch());
matcher.reset(); matcher.reset();
matcher.append("helloworld"); matcher.append("helloworld");
assertEquals(true, matcher.isMatch()); assertTrue(matcher.isMatch());
assertEquals(false, matcher.canAppendMatch()); assertFalse(matcher.canAppendMatch());
} }
@Test @Test
@ -853,30 +854,30 @@ public class FileNameMatcherTest {
final FileNameMatcher matcher = new FileNameMatcher(pattern, null); final FileNameMatcher matcher = new FileNameMatcher(pattern, null);
matcher.append("hello"); matcher.append("hello");
final FileNameMatcher childMatcher = matcher.createMatcherForSuffix(); final FileNameMatcher childMatcher = matcher.createMatcherForSuffix();
assertEquals(false, matcher.isMatch()); assertFalse(matcher.isMatch());
assertEquals(true, matcher.canAppendMatch()); assertTrue(matcher.canAppendMatch());
assertEquals(false, childMatcher.isMatch()); assertFalse(childMatcher.isMatch());
assertEquals(true, childMatcher.canAppendMatch()); assertTrue(childMatcher.canAppendMatch());
matcher.append("world"); matcher.append("world");
assertEquals(true, matcher.isMatch()); assertTrue(matcher.isMatch());
assertEquals(false, matcher.canAppendMatch()); assertFalse(matcher.canAppendMatch());
assertEquals(false, childMatcher.isMatch()); assertFalse(childMatcher.isMatch());
assertEquals(true, childMatcher.canAppendMatch()); assertTrue(childMatcher.canAppendMatch());
childMatcher.append("world"); childMatcher.append("world");
assertEquals(true, matcher.isMatch()); assertTrue(matcher.isMatch());
assertEquals(false, matcher.canAppendMatch()); assertFalse(matcher.canAppendMatch());
assertEquals(true, childMatcher.isMatch()); assertTrue(childMatcher.isMatch());
assertEquals(false, childMatcher.canAppendMatch()); assertFalse(childMatcher.canAppendMatch());
childMatcher.reset(); childMatcher.reset();
assertEquals(true, matcher.isMatch()); assertTrue(matcher.isMatch());
assertEquals(false, matcher.canAppendMatch()); assertFalse(matcher.canAppendMatch());
assertEquals(false, childMatcher.isMatch()); assertFalse(childMatcher.isMatch());
assertEquals(true, childMatcher.canAppendMatch()); assertTrue(childMatcher.canAppendMatch());
childMatcher.append("world"); childMatcher.append("world");
assertEquals(true, matcher.isMatch()); assertTrue(matcher.isMatch());
assertEquals(false, matcher.canAppendMatch()); assertFalse(matcher.canAppendMatch());
assertEquals(true, childMatcher.isMatch()); assertTrue(childMatcher.isMatch());
assertEquals(false, childMatcher.canAppendMatch()); assertFalse(childMatcher.canAppendMatch());
} }
@Test @Test
@ -885,29 +886,29 @@ public class FileNameMatcherTest {
final FileNameMatcher matcher = new FileNameMatcher(pattern, null); final FileNameMatcher matcher = new FileNameMatcher(pattern, null);
matcher.append("hello"); matcher.append("hello");
final FileNameMatcher copy = new FileNameMatcher(matcher); final FileNameMatcher copy = new FileNameMatcher(matcher);
assertEquals(false, matcher.isMatch()); assertFalse(matcher.isMatch());
assertEquals(true, matcher.canAppendMatch()); assertTrue(matcher.canAppendMatch());
assertEquals(false, copy.isMatch()); assertFalse(copy.isMatch());
assertEquals(true, copy.canAppendMatch()); assertTrue(copy.canAppendMatch());
matcher.append("world"); matcher.append("world");
assertEquals(true, matcher.isMatch()); assertTrue(matcher.isMatch());
assertEquals(false, matcher.canAppendMatch()); assertFalse(matcher.canAppendMatch());
assertEquals(false, copy.isMatch()); assertFalse(copy.isMatch());
assertEquals(true, copy.canAppendMatch()); assertTrue(copy.canAppendMatch());
copy.append("world"); copy.append("world");
assertEquals(true, matcher.isMatch()); assertTrue(matcher.isMatch());
assertEquals(false, matcher.canAppendMatch()); assertFalse(matcher.canAppendMatch());
assertEquals(true, copy.isMatch()); assertTrue(copy.isMatch());
assertEquals(false, copy.canAppendMatch()); assertFalse(copy.canAppendMatch());
copy.reset(); copy.reset();
assertEquals(true, matcher.isMatch()); assertTrue(matcher.isMatch());
assertEquals(false, matcher.canAppendMatch()); assertFalse(matcher.canAppendMatch());
assertEquals(false, copy.isMatch()); assertFalse(copy.isMatch());
assertEquals(true, copy.canAppendMatch()); assertTrue(copy.canAppendMatch());
copy.append("helloworld"); copy.append("helloworld");
assertEquals(true, matcher.isMatch()); assertTrue(matcher.isMatch());
assertEquals(false, matcher.canAppendMatch()); assertFalse(matcher.canAppendMatch());
assertEquals(true, copy.isMatch()); assertTrue(copy.isMatch());
assertEquals(false, copy.canAppendMatch()); assertFalse(copy.canAppendMatch());
} }
} }

17
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackWriterTest.java

@ -44,6 +44,7 @@
package org.eclipse.jgit.storage.file; package org.eclipse.jgit.storage.file;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
@ -134,9 +135,9 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
@Test @Test
public void testContructor() throws IOException { public void testContructor() throws IOException {
writer = new PackWriter(config, db.newObjectReader()); writer = new PackWriter(config, db.newObjectReader());
assertEquals(false, writer.isDeltaBaseAsOffset()); assertFalse(writer.isDeltaBaseAsOffset());
assertEquals(true, config.isReuseDeltas()); assertTrue(config.isReuseDeltas());
assertEquals(true, config.isReuseObjects()); assertTrue(config.isReuseObjects());
assertEquals(0, writer.getObjectCount()); assertEquals(0, writer.getObjectCount());
} }
@ -148,14 +149,14 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
config.setReuseDeltas(false); config.setReuseDeltas(false);
config.setReuseObjects(false); config.setReuseObjects(false);
config.setDeltaBaseAsOffset(false); config.setDeltaBaseAsOffset(false);
assertEquals(false, config.isReuseDeltas()); assertFalse(config.isReuseDeltas());
assertEquals(false, config.isReuseObjects()); assertFalse(config.isReuseObjects());
assertEquals(false, config.isDeltaBaseAsOffset()); assertFalse(config.isDeltaBaseAsOffset());
writer = new PackWriter(config, db.newObjectReader()); writer = new PackWriter(config, db.newObjectReader());
writer.setDeltaBaseAsOffset(true); writer.setDeltaBaseAsOffset(true);
assertEquals(true, writer.isDeltaBaseAsOffset()); assertTrue(writer.isDeltaBaseAsOffset());
assertEquals(false, config.isDeltaBaseAsOffset()); assertFalse(config.isDeltaBaseAsOffset());
} }
/** /**

8
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/OpenSshConfigTest.java

@ -44,8 +44,10 @@
package org.eclipse.jgit.transport; package org.eclipse.jgit.transport;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -228,7 +230,7 @@ public class OpenSshConfigTest extends RepositoryTestCase {
public void testAlias_BatchModeDefault() throws Exception { public void testAlias_BatchModeDefault() throws Exception {
final Host h = osc.lookup("orcz"); final Host h = osc.lookup("orcz");
assertNotNull(h); assertNotNull(h);
assertEquals(false, h.isBatchMode()); assertFalse(h.isBatchMode());
} }
@Test @Test
@ -236,7 +238,7 @@ public class OpenSshConfigTest extends RepositoryTestCase {
config("Host orcz\n" + "\tBatchMode yes\n"); config("Host orcz\n" + "\tBatchMode yes\n");
final Host h = osc.lookup("orcz"); final Host h = osc.lookup("orcz");
assertNotNull(h); assertNotNull(h);
assertEquals(true, h.isBatchMode()); assertTrue(h.isBatchMode());
} }
@Test @Test
@ -245,6 +247,6 @@ public class OpenSshConfigTest extends RepositoryTestCase {
+ "\tBatchMode yes\n"); + "\tBatchMode yes\n");
final Host h = osc.lookup("orcz"); final Host h = osc.lookup("orcz");
assertNotNull(h); assertNotNull(h);
assertEquals(true, h.isBatchMode()); assertTrue(h.isBatchMode());
} }
} }

Loading…
Cancel
Save