@Override
  public void execute(final List<String> args, final PrintWriter terminal) {
    CliCmdUtil.ensureArgCountBounds(args, 0, 1, HELP);

    if (args.isEmpty()) {
      terminal.println(restClient.getServerAddress());
      return;
    } else {
      final String serverAddress = args.get(0);
      restClient.setServerAddress(serverAddress);
      terminal.println("Server now: " + serverAddress);
      resetCliForNewServer.fire();
    }

    validateClient(terminal, restClient);
  }
@Test
  public void shouldPrintErrorOnErrorResponseFromRestClient() {
    // Given:
    reset(restClient);
    givenServerAddressHandling();
    when(restClient.getServerInfo()).thenReturn(RestResponse.erroneous(
        INTERNAL_SERVER_ERROR.code(), "it is broken"));

    // When:
    command.execute(ImmutableList.of(VALID_SERVER_ADDRESS), terminal);

    // Then:
    assertThat(out.toString(), containsString("it is broken"));
  }