SendEventRequestValidator { void validate(SendEventRequest request) { validator.validate(request, false); for (SendEventRequest.Event event : request.events) { validate(event); } }    }
@Test void validate() { assertThatThrownBy(() -> validator.validate(request(SendEventRequest.Result.OK, null, null))) .isInstanceOf(BadRequestException.class); assertThatThrownBy(() -> validator.validate(request(SendEventRequest.Result.WARN, null, null))) .isInstanceOf(BadRequestException.class); assertThatThrownBy(() -> validator.validate(request(SendEventRequest.Result.ERROR, null, null))) .isInstanceOf(BadRequestException.class); validator.validate(request(SendEventRequest.Result.OK, "action", null)); validator.validate(request(SendEventRequest.Result.WARN, null, "ERROR_CODE")); validator.validate(request(SendEventRequest.Result.ERROR, null, "ERROR_CODE")); }