コード例 #1
0
 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));
     }
   }
 }
コード例 #2
0
 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));
   }
 }
コード例 #3
0
 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));
   }
 }
コード例 #4
0
 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));
     }
   }
 }
コード例 #5
0
 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));
   }
 }