Search in sources :

Example 1 with RestResponse

use of io.confluent.ksql.rest.client.RestResponse in project ksql by confluentinc.

the class RemoteCliSpecificCommandTest method shouldPrintErrorOnErrorResponseFromRestClient.

@Test
public void shouldPrintErrorOnErrorResponseFromRestClient() {
    final Cli.RemoteServerSpecificCommand command = new Cli.RemoteServerSpecificCommand(new KsqlRestClient("xxxx", Collections.emptyMap()) {

        @Override
        public RestResponse<ServerInfo> getServerInfo() {
            return RestResponse.erroneous(new ErrorMessage("it is broken", Collections.emptyList()));
        }
    }, new PrintWriter(out));
    command.execute("http://localhost:8088");
    assertThat(out.toString(), containsString("it is broken"));
}
Also used : KsqlRestClient(io.confluent.ksql.rest.client.KsqlRestClient) RestResponse(io.confluent.ksql.rest.client.RestResponse) ErrorMessage(io.confluent.ksql.rest.entity.ErrorMessage) PrintWriter(java.io.PrintWriter) Test(org.junit.Test)

Aggregations

KsqlRestClient (io.confluent.ksql.rest.client.KsqlRestClient)1 RestResponse (io.confluent.ksql.rest.client.RestResponse)1 ErrorMessage (io.confluent.ksql.rest.entity.ErrorMessage)1 PrintWriter (java.io.PrintWriter)1 Test (org.junit.Test)1