⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testcommandline.java

📁 UML for Java Programmers中文版源码
💻 JAVA
字号:
package com.objectmentor.SMCRemote.server;

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

  public void tearDown() throws Exception {
    super.tearDown();
    SMCRemoteService.messageFile = null;
    SMCRemoteService.isVerbose = false;
    SMCRemoteService.servicePort = Integer.parseInt(SMCRemoteService.DEFAULT_PORT);
  }

  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", "-m", "message.txt"}));
    assertEquals("port", 999, SMCRemoteService.servicePort);
    assert("verbose", SMCRemoteService.isVerbose == true);
    assertEquals("message", "message.txt", SMCRemoteService.messageFile);
  }

  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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -