Search in sources :

Example 1 with HelpTelnetHandler

use of org.apache.dubbo.remoting.telnet.support.command.HelpTelnetHandler in project dubbo by alibaba.

the class HelpTelnetHandlerTest method test.

@Test
public void test() {
    Channel channel = Mockito.mock(Channel.class);
    Mockito.when(channel.getUrl()).thenReturn(URL.valueOf("dubbo://127.0.0.1:12345"));
    HelpTelnetHandler helpTelnetHandler = new HelpTelnetHandler();
    // default output
    String prompt = "Please input \"help [command]\" show detail.\r\n";
    Assertions.assertTrue(helpTelnetHandler.telnet(channel, "").contains(prompt));
    // "help" command output
    String demoOutput = "Command:\r\n" + "    help [command]\r\n" + "Summary:\r\n" + "    Show help.\r\n" + "Detail:\r\n" + "    Show help.";
    Assertions.assertEquals(helpTelnetHandler.telnet(channel, "help"), demoOutput);
}
Also used : HelpTelnetHandler(org.apache.dubbo.remoting.telnet.support.command.HelpTelnetHandler) Channel(org.apache.dubbo.remoting.Channel) Test(org.junit.jupiter.api.Test)

Aggregations

Channel (org.apache.dubbo.remoting.Channel)1 HelpTelnetHandler (org.apache.dubbo.remoting.telnet.support.command.HelpTelnetHandler)1 Test (org.junit.jupiter.api.Test)1