Skip to content

Commit

Permalink
Explicit null checking
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejagodzinski committed Oct 25, 2021
1 parent 5bfdd23 commit 6cc9804
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/test/java/TestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ public static void verifyOneAndOnlyOneEventSentToSplunk(String msg) throws IOExc
break;
}

resultsReader.close();
resultsStream.close();
Objects.requireNonNull(resultsReader, "resultsReader must not be null").close();
Objects.requireNonNull(resultsStream, "resultsStream must not be null").close();

Assert.assertTrue(eventCount == 1);
}
Expand Down Expand Up @@ -399,8 +399,8 @@ public static void verifyNoEventSentToSplunk(List<String> msgs) throws IOExcepti
break;
}

resultsReader.close();
resultsStream.close();
Objects.requireNonNull(resultsReader, "resultsReader must not be null").close();
Objects.requireNonNull(resultsStream, "resultsStream must not be null").close();

Assert.assertTrue(eventCount == 0);
}
Expand Down Expand Up @@ -444,8 +444,8 @@ public static void verifyEventsSentToSplunk(List<String> msgs) throws IOExceptio
Thread.sleep(5000);
}

resultsReader.close();
resultsStream.close();
Objects.requireNonNull(resultsReader, "resultsReader must not be null").close();
Objects.requireNonNull(resultsStream, "resultsStream must not be null").close();

Assert.assertEquals("Event search results did not match.", 1, eventCount);
}
Expand Down Expand Up @@ -496,8 +496,8 @@ public static void verifyEventsSentInOrder(String prefix, int totalEventsCount,
break;
}

resultsReader.close();
resultsStream.close();
Objects.requireNonNull(resultsReader, "resultsReader must not be null").close();
Objects.requireNonNull(resultsStream, "resultsStream must not be null").close();

assert (results.size() == totalEventsCount) : String.format("expect: %d, actual: %d", totalEventsCount, results.size());

Expand Down

0 comments on commit 6cc9804

Please sign in to comment.