public void aGrepResultsWithMultipleFilesMultipleExtracts() { GrepResults results = grep( constantExpression("ER"), on(Arrays.asList(localProfileWithWildecard("*"))), extraLinesAfter(20)); for (GrepResult result : results) { if (result.getFileName().endsWith("gz")) { assertThat( StringUtils.contains( result.filterBy(regularExpression("OR")).filterBy(regularExpression("2")).getText(), "GZ ERROR 1"), is(false)); assertThat( StringUtils.contains( result.filterBy(regularExpression("OR")).filterBy(regularExpression("1")).getText(), "GZ ERROR 2"), is(false)); } else { assertThat( StringUtils.contains( result .filterBy(regularExpression("fine")) .filterBy(regularExpression("extract")) .filterBy(regularExpression("(.*)ub(.*)")) .getText(), "fine double extract"), is(true)); } } }
public void aGrepResultsSetWithSingleFileMultipleExtracts() { GrepResults results = grep(constantExpression("ERROR 1"), on(localProfile()), extraLinesAfter(20)); for (GrepResult result : results.filterBy(regularExpression("f(.*)e")).filterBy(regularExpression("ext(.*)ct"))) { assertThat(StringUtils.contains(result.getText(), "fine extract"), is(true)); } }
public void aGrepResultsWithSingleFile() { GrepResults results = grep(constantExpression("ERROR 1"), on(localProfile()), extraLinesAfter(20)); for (GrepResult result : results) { assertThat( StringUtils.contains( result.getText(), "customer Marco(id=12345) has been updated successfully"), is(true)); } }
public void aGrepResultsSetWithMultipleFiles() { GrepResults results = grep( constantExpression("er"), on(Arrays.asList(localProfileWithWildecard("*"))), extraLinesAfter(20), ignoreCase()); for (GrepResult result : results.filterBy(regularExpression("ER(.*)OR"))) { if (result.getFileName().endsWith("gz")) { assertThat(StringUtils.contains(result.getText(), "GZ ERROR 1"), is(true)); assertThat(StringUtils.contains(result.getText(), "GZ ERROR 2"), is(true)); } else { assertThat(StringUtils.contains(result.getText(), "ERROR 1"), is(true)); assertThat(StringUtils.contains(result.getText(), "ERROR 2"), is(true)); } } }
public void aGrepResultsWithSingleFileAndOOption() { GrepResults results = grep(constantExpression("error 1"), on(localProfile()), ignoreCase()); for (GrepResult result : results) { assertThat(StringUtils.contains(result.getText(), "ERROR 1"), is(true)); } }