ListGatewayCommand extends GfshCommand { static String getStatus(GatewaySenderMXBean mbean) { if (!mbean.isRunning()) { return CliStrings.GATEWAY_NOT_RUNNING; } if (mbean.isPaused()) { return CliStrings.SENDER_PAUSED; } if (mbean.isConnected()) { return CliStrings.GATEWAY_RUNNING_CONNECTED; } return CliStrings.GATEWAY_RUNNING_NOT_CONNECTED; }  @CliCommand(value = CliStrings.LIST_GATEWAY, help = CliStrings.LIST_GATEWAY__HELP) @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN) @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER, operation = ResourcePermission.Operation.READ) ResultModel listGateway(
      @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
          optionContext = ConverterHint.MEMBERIDNAME,
          help = CliStrings.LIST_GATEWAY__MEMBER__HELP) String[] onMember,
      @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
          optionContext = ConverterHint.MEMBERGROUP,
          help = CliStrings.LIST_GATEWAY__GROUP__HELP) String[] onGroup,
      @CliOption(key = {CliStrings.LIST_GATEWAY__SHOW_RECEIVERS_ONLY},
          specifiedDefaultValue = "true", unspecifiedDefaultValue = "false",
          help = CliStrings.LIST_GATEWAY__SHOW_RECEIVERS_ONLY__HELP) boolean showReceiversOnly,
      @CliOption(key = {CliStrings.LIST_GATEWAY__SHOW_SENDERS_ONLY},
          specifiedDefaultValue = "true", unspecifiedDefaultValue = "false",
          help = CliStrings.LIST_GATEWAY__SHOW_SENDERS_ONLY__HELP) boolean showSendersOnly);  }
@Test public void getGatewaySenderStatus() { when(senderMXBean.isRunning()).thenReturn(false); assertThat(ListGatewayCommand.getStatus(senderMXBean)).isEqualTo("Not Running"); when(senderMXBean.isRunning()).thenReturn(true); when(senderMXBean.isPaused()).thenReturn(true); assertThat(ListGatewayCommand.getStatus(senderMXBean)).isEqualTo("Paused"); when(senderMXBean.isPaused()).thenReturn(false); when(senderMXBean.isConnected()).thenReturn(false); assertThat(ListGatewayCommand.getStatus(senderMXBean)).isEqualTo("Running, not Connected"); when(senderMXBean.isConnected()).thenReturn(true); assertThat(ListGatewayCommand.getStatus(senderMXBean)).isEqualTo("Running and Connected"); }