### Question:
ApiManagerAuditProcessor { public ApiManagerAuditEvent getEvent(Map<String, Object> data) { final String remoteAddress = (String) data.get(Constants.REMOTE_ADDRESS); final Ontology ontology = (Ontology) data.get(Constants.ONTOLOGY); final String method = (String) data.get(Constants.METHOD); final String query = (String) data.get(Constants.QUERY); final byte[] body = (byte[]) data.get(Constants.BODY); final User user = (User) data.get(Constants.USER); final Api api = (Api) data.get(Constants.API); final OperationType operationType = getAuditOperationFromMethod(method); final String operation = getOperation(operationType); final Date today = new Date(); final String userId = getUserId(user); final String ontologyId = getOntologyId(ontology); final String message = operation + " on ontology " + ontologyId + " by user " + userId; return (ApiManagerAuditEvent.builder().id(UUID.randomUUID().toString()).module(Module.APIMANAGER) .type(EventType.APIMANAGER).operationType(operation).resultOperation(ResultOperationType.SUCCESS) .remoteAddress(remoteAddress).message(message).data(body == null ? null : new String(body)) .ontology(ontologyId).query(query).timeStamp(today.getTime()).user(userId) .api(api != null ? api.getIdentification() : null) .formatedTimeStamp(CalendarUtil.builder().build().convert(today)).build()); }  ApiManagerAuditEvent getStoppedEvent(Map<String, Object> data); ApiManagerAuditEvent getEvent(Map<String, Object> data); OPAuditError getErrorEvent(Map<String, Object> data, Exception ex); ApiManagerAuditEvent completeEvent(ApiManagerAuditEvent event); OperationType getAuditOperationFromMethod(String method); String getUserId(User user); String getOntologyId(Ontology ontology); String getOperation(OperationType operationType);  }### Answer:
@Test public void given_insert_event_getEvent() { final Map<String, Object> data = new HashMap<>(); final String body = "{'test':'test'}"; data.put(Constants.REMOTE_ADDRESS, REMOTE_ADDRESS); data.put(Constants.ONTOLOGY, getOntologyTest()); data.put(Constants.METHOD, ApiOperation.Type.POST.name()); data.put(Constants.BODY, body.getBytes()); data.put(Constants.USER, getUserTest()); data.put(Constants.API, getApiTest()); final ApiManagerAuditEvent event = apiManagerAuditProcessor.getEvent(data); assertEquals(ONTOLOGY_NAME, event.getOntology()); assertEquals(REMOTE_ADDRESS, event.getRemoteAddress()); assertEquals(OperationType.INSERT.name(), event.getOperationType()); assertEquals(ResultOperationType.SUCCESS, event.getResultOperation()); assertEquals(Module.APIMANAGER, event.getModule()); assertEquals(EventType.APIMANAGER, event.getType()); assertEquals(body, event.getData()); Assert.assertNull(event.getQuery()); assertEquals(USER_ID, event.getUser()); }