public void testNoArgs() {
    AtomicBoolean startCalled = new AtomicBoolean(false);
    AtomicBoolean stopCalled = new AtomicBoolean(false);
    StringWriter out = new StringWriter();
    PrintWriter writer = new PrintWriter(out);
    ServerCommandLine commandLine =
        new ServerCommandLine("test-cli", writer) {
          @Override
          protected void start() {
            startCalled.set(true);
          }

          @Override
          protected void remove(Set<Integer> nodeIds) {
            stopCalled.set(true);
          }
        };
    int returnCode = commandLine.run(new String[0]);

    Assert.assertEquals(1, returnCode);
    String consoleOutput = out.toString();
    Assert.assertTrue(consoleOutput.contains("Missing required option"));
    // No callbacks should have been called.
    Assert.assertFalse(startCalled.get());
    Assert.assertFalse(stopCalled.get());
  }
In this test, the commandline is called without any args. In this case the usage should be
output and nothing should be done.
iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/ServerCommandLineTest.java