### Question:
FlowEngineAuditProcessor { public OPAuditError getErrorEvent(String methodName, FlowEngineDomain domain, Exception ex) { log.debug("getEventError for operation " + methodName); String userId = getUserId(domain); String messageOperation = "Exception Detected while executing " + methodName + " for domain : " + domain.getDomain(); return createErrorEvent(userId, messageOperation, ex); }  String getUserId(String domainId); String getUserId(FlowEngineDomain domain); FlowEngineAuditEvent getEvent(String methodName, String retVal, FlowEngineDomain domain,
			OperationType operation); FlowEngineAuditEvent getEvent(String methodName, String domainId, OperationType operation); FlowEngineAuditEvent getQueryEvent(String ontology, String query, String queryType, String retVal,
			String domainName); FlowEngineAuditEvent getInsertEvent(String ontology, String data, String retVal, String domainName); FlowEngineAuditEvent getEvent(String ontology, String query, String queryType, String data, String message,
			String domainName, OperationType operation); FlowEngineAuditEvent getEvent(String domain, String user, OperationType operation, String message,
			ResultOperationType result); OPAuditError getErrorEvent(String methodName, FlowEngineDomain domain, Exception ex); OPAuditError getErrorEvent(String message, String domainName, Exception ex); OPAuditError getErrorEvent(String method, String message, String domain, Exception ex); OPAuditError createErrorEvent(String userId, String message, Exception ex);  }### Answer:
@Test public void given_get_error_event_incorrect_credentials() { when(domainService.getFlowDomainById(DOMAIN_ID)).thenThrow(new NotAuthorizedException("")); OPAuditError error = flowEngineAuditProcessor.getErrorEvent("", DOMAIN_ID, new Exception()); Assert.assertNull(error); }
@Test public void given_get_error_event() { Exception ex = new Exception(); String methodName = "dummyMethod"; FlowEngineDomain domain = FlowEngineDomain.builder().domain(DOMAIN_ID).build(); FlowDomain flowDomain = new FlowDomain(); flowDomain.setUser(getTestUser()); when(domainService.getFlowDomainById(DOMAIN_ID)).thenReturn(getTestFlowDomain()); OPAuditError event = flowEngineAuditProcessor.getErrorEvent(methodName, domain, ex); assertEquals(EventType.ERROR, event.getType()); Assert.assertNotNull(event.getMessage()); assertEquals(ex.getMessage(), event.getErrorMessage()); assertEquals(Module.FLOWENGINE, event.getModule()); assertEquals(USER_ID, event.getUser()); }