299 public static void hasEvent(List<RecordedEvent> events, String name) throws IOException { 300 if (!containsEvent(events, name)) { 301 Asserts.fail("Missing event " + name + " in recording " + events.toString()); 302 } 303 } 304 305 public static void hasNotEvent(List<RecordedEvent> events, String name) throws IOException { 306 if (containsEvent(events, name)) { 307 Asserts.fail("Rercording should not contain event " + name + " " + events.toString()); 308 } 309 } 310 311 private static boolean containsEvent(List<RecordedEvent> events, String name) { 312 for (RecordedEvent event : events) { 313 if (event.getEventType().getName().equals(name)) { 314 return true; 315 } 316 } 317 return false; 318 } 319 } | 299 public static void hasEvent(List<RecordedEvent> events, String name) throws IOException { 300 if (!containsEvent(events, name)) { 301 Asserts.fail("Missing event " + name + " in recording " + events.toString()); 302 } 303 } 304 305 public static void hasNotEvent(List<RecordedEvent> events, String name) throws IOException { 306 if (containsEvent(events, name)) { 307 Asserts.fail("Rercording should not contain event " + name + " " + events.toString()); 308 } 309 } 310 311 private static boolean containsEvent(List<RecordedEvent> events, String name) { 312 for (RecordedEvent event : events) { 313 if (event.getEventType().getName().equals(name)) { 314 return true; 315 } 316 } 317 return false; 318 } 319 320 public static void assertEventCount(List<RecordedEvent> events, int expectedCount) { 321 if (events.size() != expectedCount) { 322 Asserts.fail("Incorrect number of TLSHandshake Events. Expected " + expectedCount + " but got " + events.size()); 323 } 324 } 325 } |