From a9ae1251659d56566815b97a08bc66b6ff8e8e61 Mon Sep 17 00:00:00 2001 From: mikr Date: Wed, 18 Aug 2021 12:35:08 +0200 Subject: [PATCH] JAVA-5950 Reduce size of core-java-os. --- .../grep/GrepWithUnix4JIntegrationTest.java | 12 ++++++------ .../core-java-os/src/test/resources/dictionary.in | 13 +++++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 core-java-modules/core-java-os/src/test/resources/dictionary.in 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