diff --git a/core-java-modules/core-java-os/src/test/java/com/baeldung/grep/GrepWithUnix4JIntegrationTest.java b/core-java-modules/core-java-os/src/test/java/com/baeldung/grep/GrepWithUnix4JIntegrationTest.java index 3ea7acf620..5c9da0cc9e 100644 --- a/core-java-modules/core-java-os/src/test/java/com/baeldung/grep/GrepWithUnix4JIntegrationTest.java +++ b/core-java-modules/core-java-os/src/test/java/com/baeldung/grep/GrepWithUnix4JIntegrationTest.java @@ -25,9 +25,9 @@ public class GrepWithUnix4JIntegrationTest { @Test public void whenGrepWithSimpleString_thenCorrect() { - int expectedLineCount = 4; + int expectedLineCount = 5; - // grep "NINETEEN" dictionary.txt + // grep "NINETEEN" dictionary.in List lines = Unix4j.grep("NINETEEN", fileToGrep).toLineList(); assertEquals(expectedLineCount, lines.size()); @@ -35,9 +35,9 @@ public class GrepWithUnix4JIntegrationTest { @Test public void whenInverseGrepWithSimpleString_thenCorrect() { - int expectedLineCount = 178687; + int expectedLineCount = 8; - // grep -v "NINETEEN" dictionary.txt + // grep -v "NINETEEN" dictionary.in List lines = grep(Options.v, "NINETEEN", fileToGrep).toLineList(); assertEquals(expectedLineCount, lines.size()); @@ -45,9 +45,9 @@ public class GrepWithUnix4JIntegrationTest { @Test public void whenGrepWithRegex_thenCorrect() { - int expectedLineCount = 151; + int expectedLineCount = 5; - // grep -c ".*?NINE.*?" dictionary.txt + // grep -c ".*?NINE.*?" dictionary.in String patternCount = grep(Options.c, ".*?NINE.*?", fileToGrep).cut(fields, ":", 1).toStringResult(); assertEquals(expectedLineCount, Integer.parseInt(patternCount)); diff --git a/core-java-modules/core-java-os/src/test/resources/dictionary.in b/core-java-modules/core-java-os/src/test/resources/dictionary.in new file mode 100644 index 0000000000..9e6c74ecdb --- /dev/null +++ b/core-java-modules/core-java-os/src/test/resources/dictionary.in @@ -0,0 +1,13 @@ +EIGHTTEEN +EIGHTTEENS +EIGHTTEENTH +EIGHTTEENTHS +NINETEEN +NINETEENS +NINETEENTH +NINETEENTHS +TWENTY +TWENTHIES +TWENTHIETH +TWENTHIETHS +TWENTYNINETEEN \ No newline at end of file