@Test
  public void successIsLoggedIfAceRequiresSuccessAudit() throws Exception {
    when(ace.isAuditSuccess()).thenReturn(true);

    logger.logIfNeeded(true, ace);
    assertThat(bytes.toString().startsWith("GRANTED due to ACE")).isTrue();
  }
 @Test
 public void failureIsLoggedIfAceRequiresFailureAudit() throws Exception {
   when(ace.isAuditFailure()).thenReturn(true);
   logger.logIfNeeded(false, ace);
   assertThat(bytes.toString().startsWith("DENIED due to ACE")).isTrue();
 }
 @Test
 public void failureIsntLoggedIfAceDoesntRequireFailureAudit() throws Exception {
   when(ace.isAuditFailure()).thenReturn(false);
   logger.logIfNeeded(false, ace);
   assertThat(bytes.size()).isEqualTo(0);
 }
 @Test
 public void successIsNotLoggedIfAceDoesntRequireSuccessAudit() throws Exception {
   when(ace.isAuditSuccess()).thenReturn(false);
   logger.logIfNeeded(true, ace);
   assertThat(bytes.size()).isEqualTo(0);
 }