Skip to content

Commit

Permalink
samples: Fix failing tests (#1591)
Browse files Browse the repository at this point in the history
* Fix failing tests

* Replace with regex

* x and y not just x
  • Loading branch information
nnegrey authored and chingor13 committed Aug 13, 2020
1 parent 81da681 commit 91cd1b3
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions vision/snippets/src/test/java/com/example/vision/DetectIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.io.IOException;
import java.io.PrintStream;
import java.util.UUID;
import java.util.regex.Pattern;

import org.junit.After;
import org.junit.Before;
Expand All @@ -46,7 +47,7 @@ public class DetectIT {
private static final String OUTPUT_PREFIX = "OCR_PDF_TEST_OUTPUT_" + UUID.randomUUID().toString();

@Before
public void setUp() throws IOException {
public void setUp() {
bout = new ByteArrayOutputStream();
out = new PrintStream(bout);
System.setOut(out);
Expand Down Expand Up @@ -312,8 +313,8 @@ public void testCropHints() throws Exception {
// Assert
String got = bout.toString();
assertThat(got).contains("vertices {");
assertThat(got).contains("x: 599");
assertThat(got).contains("y: 475");
assertThat(got).containsMatch(Pattern.compile("x: 2\\d{2}"));
assertThat(got).containsMatch(Pattern.compile("y: 4\\d{2}"));
}

@Test
Expand All @@ -325,8 +326,8 @@ public void testCropHintsGcs() throws Exception {
// Assert
String got = bout.toString();
assertThat(got).contains("vertices {");
assertThat(got).contains("x: 599");
assertThat(got).contains("y: 475");
assertThat(got).containsMatch(Pattern.compile("x: 2\\d{2}"));
assertThat(got).containsMatch(Pattern.compile("y: 4\\d{2}"));
}

@Test
Expand Down

0 comments on commit 91cd1b3

Please sign in to comment.