source: trunk/java-utils-test/src/test/java/de/ugoe/cs/util/console/defaultcommands/CMDlistCommandsTest.java @ 784

Last change on this file since 784 was 784, checked in by sherbold, 12 years ago
  • code documentation
File size: 1.1 KB
Line 
1
2package de.ugoe.cs.util.console.defaultcommands;
3
4import static org.junit.Assert.*;
5
6import java.util.ArrayList;
7import java.util.List;
8
9import org.junit.Before;
10import org.junit.Test;
11
12import de.ugoe.cs.util.console.CommandExecuter;
13import de.ugoe.cs.util.console.Console;
14import de.ugoe.cs.util.console.defaultcommands.CMDlistCommands;
15import de.ugoe.cs.util.console.listener.IOutputListener;
16
17public class CMDlistCommandsTest implements IOutputListener {
18
19    private List<String> commands = new ArrayList<String>();
20
21    @Before
22    public void setUp() throws Exception {
23        Console.getInstance().registerOutputListener(this);
24    }
25
26    @Test
27    public void test() {
28        CommandExecuter.getInstance().addCommandPackage("de.ugoe.cs.util.console.defaultcommands");
29        CMDlistCommands command = new CMDlistCommands();
30        command.run(null);
31
32        assertTrue(commands.size() > 0);
33
34        for (String cmd : commands) {
35            assertNotNull(cmd);
36            assertTrue(cmd.length() > 0);
37            System.out.print(cmd);
38        }
39    }
40
41    @Override
42    public void outputMsg(String newMessage) {
43        commands.add(newMessage);
44    }
45
46}
Note: See TracBrowser for help on using the repository browser.