### Question:
ApiManagerAuditProcessor { public OPAuditError getErrorEvent(Map<String, Object> data, Exception ex) { 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 User user = (User) data.get(Constants.USER); final OperationType operationType = getAuditOperationFromMethod(method); final String operation = getOperation(operationType); final String userId = getUserId(user); final String ontologyId = getOntologyId(ontology); final String messageOperation = "Exception Detected while operation : " + ontologyId + " Type : " + operation; return (OPEventFactory.builder().build().createAuditEventError(userId, messageOperation, remoteAddress, Module.APIMANAGER, ex)); }  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_event_getErrorEvent() { final Map<String, Object> data = new HashMap<>(); final Exception ex = new Exception(); final OPAuditError event = apiManagerAuditProcessor.getErrorEvent(data, ex); assertEquals(EventType.ERROR, event.getType()); Assert.assertNotNull(event.getMessage()); assertEquals(ex.getMessage(), event.getErrorMessage()); assertEquals(Module.APIMANAGER, event.getModule()); }