### Question:
ApiManagerAuditProcessor { public ApiManagerAuditEvent completeEvent(ApiManagerAuditEvent event) { if (event != null && (event.getUser() == null || "".equals(event.getUser()))) { log.debug("the user is null so set user to anonymous"); event.setUser(AuditConst.ANONYMOUS_USER); } return event; }  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_completeEvent_user_is_null() { ApiManagerAuditEvent event = ApiManagerAuditEvent.builder().build(); final Map<String, Object> retVal = new HashMap<>(); retVal.put(Constants.USER, null); event = apiManagerAuditProcessor.completeEvent(event); assertEquals(AuditConst.ANONYMOUS_USER, event.getUser()); }
@Test public void given_event_completeEvent_user_is_not_null() { ApiManagerAuditEvent event = ApiManagerAuditEvent.builder().user(USER_ID).build(); event = apiManagerAuditProcessor.completeEvent(event); assertEquals(USER_ID, event.getUser()); }