source: trunk/java-utils-test/src/test/java/de/ugoe/cs/util/console/mock/commands/CMDmockCommand.java @ 664

Last change on this file since 664 was 664, checked in by sherbold, 12 years ago
  • modified Command.help(): the help now returns a string with its usage instead of writing directly to the console
  • modified listCommands: now writes the help string of each command instead of just the name; this way, the parameters are displayed directly
  • moved listCommands from quest-ui-core to java-utils
  • Property svn:mime-type set to text/plain
File size: 603 bytes
Line 
1package de.ugoe.cs.util.console.mock.commands;
2
3import java.security.InvalidParameterException;
4import java.util.List;
5
6import de.ugoe.cs.util.console.Command;
7import de.ugoe.cs.util.console.Console;
8
9public class CMDmockCommand implements Command {
10
11        @Override
12        public void run(List<Object> parameters) {
13                switch (parameters.size()) {
14                case 0:
15                        Console.println("mock command: run");
16                        break;
17                case 1:
18                        throw new InvalidParameterException();
19                default:
20                        throw new RuntimeException();
21                }
22        }
23
24        @Override
25        public String help() {
26                return "mock command: help";
27        }
28
29}
Note: See TracBrowser for help on using the repository browser.