@Test
public void testSuccessExecution() {

    Message message = Mockito.mock(Message.class);
    Exchange exchange = Mockito.mock(Exchange.class);
    Message inMessage = getInMessage();
    Mockito.when(message.getExchange()).thenReturn(exchange);
    Mockito.when(exchange.getInMessage()).thenReturn(inMessage);
    Message outSuccessMessage = getOutSuccessMessage();
    Mockito.when(exchange.getOutMessage()).thenReturn(outSuccessMessage);
    Mockito.when(exchange.get(AuditInfo.START_TIME.getKey())).thenReturn(1000l);
    Map<String, String> auditInfo = AuditInfoExtractor.extract(message);
    assertEquals(auditInfo.size(), 18);
    assertEquals(auditInfo.get(AuditInfo.HOST.getKey()), "localhost");
    assertEquals(auditInfo.get(AuditInfo.RESPONSE_CONTENT_TYPE.getKey()), "application/octet-stream");
    assertEquals(auditInfo.get(AuditInfo.HTTP_METHOD.getKey()), "GET");
    assertEquals(auditInfo.get(AuditInfo.BODY_AS_STRING.getKey()), "body-content");
    assertEquals(auditInfo.get(AuditInfo.USER_ROLE.getKey()), "ADMIN");
    assertEquals(auditInfo.get(AuditInfo.REMOTE_HOST.getKey()), "127.0.0.1");
    assertEquals(auditInfo.get(AuditInfo.START_TIME.getKey()), "1000");
    assertEquals(auditInfo.get(AuditInfo.RESPONSE_LENGTH.getKey()), "150");
    assertEquals(auditInfo.get(AuditInfo.BASE_PATH.getKey()), "users");
    assertEquals(auditInfo.get(AuditInfo.QUERY_STRING.getKey()), "");
    assertEquals(auditInfo.get(AuditInfo.USER_GROUPS.getKey()), "everyone");
    assertEquals(auditInfo.get(AuditInfo.RESPONSE_STATUS_CODE.getKey()), "200");
    assertEquals(auditInfo.get(AuditInfo.PATH.getKey()), "users/user/15");
    assertEquals(auditInfo.get(AuditInfo.USER_NAME.getKey()), "admin");
    assertEquals(auditInfo.get(AuditInfo.REMOTE_ADDR.getKey()), "127.0.0.1");
    assertEquals(auditInfo.get(AuditInfo.REMOTE_USER.getKey()),
            "User[id=2, name=admin, group=[UserGroup[id=1, groupName=everyone]], role=ADMIN]");
    assertNotNull(auditInfo.get(AuditInfo.END_TIME.getKey()));
    assertEquals(Long.parseLong(auditInfo.get(AuditInfo.TOTAL_TIME.getKey())),
            Long.parseLong(auditInfo.get(AuditInfo.END_TIME.getKey())) - 1000);
}