public static void validate(
      final ConfiguredStatement<?> statement,
      final SessionProperties sessionProperties,
      final KsqlExecutionContext context,
      final ServiceContext serviceContext
  ) {
    throw new KsqlRestException(Errors.queryEndpoint(statement.getMaskedStatementText()));
  }
@Test
  public void shouldThrowExceptionOnPrintTopic() {
    // Given:
    final ConfiguredStatement<PrintTopic> query = ConfiguredStatement
        .of(PreparedStatement.of("PRINT 'topic';", mock(PrintTopic.class)),
            SessionConfig.of(CONFIG, ImmutableMap.of()));

    // When:
    final KsqlRestException e = assertThrows(
        KsqlRestException.class,
        () -> CustomValidators.PRINT_TOPIC.validate(
            query,
            mock(SessionProperties.class),
            ksqlEngine,
            serviceContext
        )
    );

    // Then:
    assertThat(e, exceptionStatusCode(is(BAD_REQUEST.code())));
    assertThat(e, exceptionStatementErrorMessage(errorMessage(containsString(
        "The following statement types should be issued to the websocket endpoint '/query'"
    ))));
    assertThat(e, exceptionStatementErrorMessage(statement(containsString(
        "PRINT 'topic';"))));
  }