test_class.declarator: list = new ListTelnetHandler()
test_class.modifier: private static
test_class.original_string: private static TelnetHandler list = new ListTelnetHandler();
test_class.type: TelnetHandler
test_class.var_name: list
test_class.declarator: detailMethods
test_class.modifier: private static
test_class.original_string: private static String detailMethods;
test_class.type: String
test_class.var_name: detailMethods
test_class.declarator: methodsName
test_class.modifier: private static
test_class.original_string: private static String methodsName;
test_class.type: String
test_class.var_name: methodsName
test_class.declarator: mockChannel
test_class.modifier: private
test_class.original_string: private Channel mockChannel;
test_class.type: Channel
test_class.var_name: mockChannel
test_class.declarator: mockInvoker
test_class.modifier: private
test_class.original_string: private Invoker<DemoService> mockInvoker;
test_class.type: Invoker<DemoService>
test_class.var_name: mockInvoker
test_class.file: dubbo-rpc/dubbo-rpc-dubbo/src/test/java/com/alibaba/dubbo/rpc/protocol/dubbo/telnet/ListTelnetHandlerTest.java
test_class.identifier: ListTelnetHandlerTest
test_case.body: @Test
      public void testInvaildMessage() throws RemotingException {
          mockChannel = mock(Channel.class);
          given(mockChannel.getAttribute("telnet.service")).willReturn(null);
  
          String result = list.telnet(mockChannel, "xx");
          assertEquals("No such service xx", result);
      }
test_case.class_method_signature: ListTelnetHandlerTest.testInvaildMessage()
test_case.full_signature: @Test public void testInvaildMessage()
test_case.identifier: testInvaildMessage
test_case.invocations: mock willReturn given getAttribute telnet assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testInvaildMessage()
focal_class.file: dubbo-rpc/dubbo-rpc-dubbo/src/main/java/com/alibaba/dubbo/rpc/protocol/dubbo/telnet/ListTelnetHandler.java
focal_class.identifier: ListTelnetHandler
focal_class.interfaces: implements TelnetHandler
focal_class.class_method_signature: ListTelnetHandler.telnet(Channel channel, String message)
focal_class.full_signature: @Override public String telnet(Channel channel, String message)
focal_class.identifier: telnet
focal_class.modifiers: @Override public
focal_class.parameters: (Channel channel, String message)
focal_class.return: String
focal_class.signature: String telnet(Channel channel, String message)
focal_method.body: @Override
      public String telnet(Channel channel, String message) {
          StringBuilder buf = new StringBuilder();
          String service = null;
          boolean detail = false;
          if (message.length() > 0) {
              String[] parts = message.split("\\s+");
              for (String part : parts) {
                  if ("-l".equals(part)) {
                      detail = true;
                  } else {
                      if (service != null && service.length() > 0) {
                          return "Invaild parameter " + part;
                      }
                      service = part;
                  }
              }
          } else {
              service = (String) channel.getAttribute(ChangeTelnetHandler.SERVICE_KEY);
              if (service != null && service.length() > 0) {
                  buf.append("Use default service " + service + ".\r\n");
              }
          }
          if (service == null || service.length() == 0) {
              for (Exporter<?> exporter : DubboProtocol.getDubboProtocol().getExporters()) {
                  if (buf.length() > 0) {
                      buf.append("\r\n");
                  }
                  buf.append(exporter.getInvoker().getInterface().getName());
                  if (detail) {
                      buf.append(" -> ");
                      buf.append(exporter.getInvoker().getUrl());
                  }
              }
          } else {
              Invoker<?> invoker = null;
              for (Exporter<?> exporter : DubboProtocol.getDubboProtocol().getExporters()) {
                  if (service.equals(exporter.getInvoker().getInterface().getSimpleName())
                          || service.equals(exporter.getInvoker().getInterface().getName())
                          || service.equals(exporter.getInvoker().getUrl().getPath())) {
                      invoker = exporter.getInvoker();
                      break;
                  }
              }
              if (invoker != null) {
                  Method[] methods = invoker.getInterface().getMethods();
                  for (Method method : methods) {
                      if (buf.length() > 0) {
                          buf.append("\r\n");
                      }
                      if (detail) {
                          buf.append(ReflectUtils.getName(method));
                      } else {
                          buf.append(method.getName());
                      }
                  }
              } else {
                  buf.append("No such service " + service);
              }
          }
          return buf.toString();
      }
focal_method.class_method_signature: ListTelnetHandler.telnet(Channel channel, String message)
focal_method.full_signature: @Override public String telnet(Channel channel, String message)
focal_method.identifier: telnet
focal_method.invocations: length split equals length getAttribute length append length getExporters getDubboProtocol length append append getName getInterface getInvoker append append getUrl getInvoker getExporters getDubboProtocol equals getSimpleName getInterface getInvoker equals getName getInterface getInvoker equals getPath getUrl getInvoker getInvoker getMethods getInterface length append append getName append getName append toString
focal_method.modifiers: @Override public
focal_method.parameters: (Channel channel, String message)
focal_method.return: String
focal_method.signature: String telnet(Channel channel, String message)