[go: nahoru, domu]

Skip to content

Commit

Permalink
remove unnecessary and unreachable assertion, assertEquals(true -> as…
Browse files Browse the repository at this point in the history
…sertTrue
  • Loading branch information
sjamesr committed Jun 9, 2020
1 parent bc447c8 commit 720a287
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions javatests/com/google/re2j/PatternTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.io.ByteArrayInputStream;
Expand All @@ -14,7 +15,6 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import com.google.common.truth.Truth;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
Expand Down Expand Up @@ -50,7 +50,6 @@ public void testCompileFlags() {

@Test
public void testSyntaxError() {
boolean caught = false;
try {
Pattern.compile("abc(");
fail("should have thrown");
Expand All @@ -59,9 +58,7 @@ public void testSyntaxError() {
assertNotSame("", e.getDescription());
assertNotSame("", e.getMessage());
assertEquals("abc(", e.getPattern());
caught = true;
}
assertEquals(true, caught);
}

@Test
Expand Down Expand Up @@ -89,8 +86,8 @@ public void testMatchesWithFlags() {
}

private void testFind(String regexp, int flag, String match, String nonMatch) {
assertEquals(true, Pattern.compile(regexp, flag).matcher(match).find());
assertEquals(false, Pattern.compile(regexp, flag).matcher(nonMatch).find());
assertTrue(Pattern.compile(regexp, flag).matcher(match).find());
assertFalse(Pattern.compile(regexp, flag).matcher(nonMatch).find());
}

@Test
Expand Down

0 comments on commit 720a287

Please sign in to comment.