### Question:
Auditer implements AuditProvider { public List<TracedAuditEvent> getMessages() { return messages; }  List<TracedAuditEvent> getMessages(); @Override Consumer<TracedAuditEvent> auditConsumer();  }### Answer:
@Test public void integrateIt() throws InterruptedException { Auditer auditer = new Auditer(); Security sec = Security.builder() .addAuthorizationProvider(new AtzProviderSync()) .addAuditProvider(auditer) .build(); SecurityContext context = sec.createContext("unit-test"); context.env(SecurityEnvironment.builder() .path("/public/path")); AuthorizationResponse response = context.authorize(); Thread.sleep(100); List<AuditProvider.TracedAuditEvent> messages = auditer.getMessages(); List<AuditProvider.TracedAuditEvent> atzEvents = messages.stream() .filter(event -> event.eventType().startsWith(AuditEvent.AUTHZ_TYPE_PREFIX)) .collect(Collectors.toList()); assertThat("We only expect a single authorization event", atzEvents.size(), is(1)); }