test_class.file: server/src/test/java/io/spine/server/event/EventValidatorTest.java
test_class.identifier: EventValidatorTest
test_case.body: @Test
      @DisplayName("validate event messages")
      void validateEventMessages() {
          Event eventWithDefaultMessage = Event
                  .newBuilder()
                  .setMessage(pack(ProjectCreated.getDefaultInstance()))
                  .build();
          EventValidator eventValidator = new EventValidator();
          Optional<MessageInvalid> error = eventValidator.validate(
                  EventEnvelope.of(eventWithDefaultMessage)
          );
          assertTrue(error.isPresent());
          Error actualError = error.get().asError();
          assertEquals(EventValidationError.getDescriptor().getFullName(), actualError.getType());
      }
test_case.class_method_signature: EventValidatorTest.validateEventMessages()
test_case.full_signature: @Test @DisplayName("validate event messages") void validateEventMessages()
test_case.identifier: validateEventMessages
test_case.invocations: build setMessage newBuilder pack getDefaultInstance validate of assertTrue isPresent asError get assertEquals getFullName getDescriptor getType
test_case.modifiers: @Test @DisplayName("validate event messages")
test_case.parameters: ()
test_case.return: void
test_case.signature: void validateEventMessages()
focal_class.file: server/src/main/java/io/spine/server/event/EventValidator.java
focal_class.identifier: EventValidator
focal_class.interfaces: implements EnvelopeValidator<EventEnvelope>
focal_class.class_method_signature: EventValidator.validate(EventEnvelope event)
focal_class.full_signature: @Override public Optional<MessageInvalid> validate(EventEnvelope event)
focal_class.identifier: validate
focal_class.modifiers: @Override public
focal_class.parameters: (EventEnvelope event)
focal_class.return: Optional<MessageInvalid>
focal_class.signature: Optional<MessageInvalid> validate(EventEnvelope event)
focal_method.body: @Override
      public Optional<MessageInvalid> validate(EventEnvelope event) {
          checkNotNull(event);
          Event outerObject = event.outerObject();
          List<ConstraintViolation> violations = Validate.violationsOf(outerObject);
          if (violations.isEmpty()) {
              return Optional.empty();
          }
          EventMessage message = event.message();
          MessageInvalid result = onConstraintViolations(message, violations);
          return Optional.of(result);
      }
focal_method.class_method_signature: EventValidator.validate(EventEnvelope event)
focal_method.full_signature: @Override public Optional<MessageInvalid> validate(EventEnvelope event)
focal_method.identifier: validate
focal_method.invocations: checkNotNull outerObject violationsOf isEmpty empty message onConstraintViolations of
focal_method.modifiers: @Override public
focal_method.parameters: (EventEnvelope event)
focal_method.return: Optional<MessageInvalid>
focal_method.signature: Optional<MessageInvalid> validate(EventEnvelope event)