Line | |
---|
1 | |
---|
2 | package de.ugoe.cs.util.console.defaultcommands; |
---|
3 | |
---|
4 | import static org.junit.Assert.*; |
---|
5 | |
---|
6 | import java.util.ArrayList; |
---|
7 | import java.util.List; |
---|
8 | |
---|
9 | import org.junit.Before; |
---|
10 | import org.junit.Test; |
---|
11 | |
---|
12 | import de.ugoe.cs.util.console.CommandExecuter; |
---|
13 | import de.ugoe.cs.util.console.Console; |
---|
14 | import de.ugoe.cs.util.console.defaultcommands.CMDlistCommands; |
---|
15 | import de.ugoe.cs.util.console.listener.IOutputListener; |
---|
16 | |
---|
17 | public 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.