testcommandline.java

来自「UML for Java Programmers中文版源码」· Java 代码 · 共 31 行

JAVA
31
字号
package com.objectmentor.SMCRemote.server;

public class TestCommandLine extends TestBase {
  public TestCommandLine(String name) {
    super(name);
  }

  public void tearDown() throws Exception {
    super.tearDown();
  }

  public void setUp() throws Exception {
    super.setUp();
  }

  public void testValidCommandLine() throws Exception {
    assert("Null Command Line", SMCRemoteService.parseCommandLine(new String[0]));
    assertEquals("default port", Integer.parseInt(SMCRemoteService.DEFAULT_PORT), SMCRemoteService.servicePort);
    assert("default verbose", SMCRemoteService.isVerbose == false);

    assert("Parametric Command Line", SMCRemoteService.parseCommandLine(new String[]{"-p", "999", "-v"}));
    assertEquals("port", 999, SMCRemoteService.servicePort);
    assert("verbose", SMCRemoteService.isVerbose == true);
  }

  public void testInvalidCommandLine() throws Exception {
    assertEquals("Invalid Command Line", false, SMCRemoteService.parseCommandLine(new String[]{"-x"}));
    assertEquals("Bad Port", false, SMCRemoteService.parseCommandLine(new String[]{"-p", "badport"}));
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?