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

Last change on this file since 927 was 927, checked in by sherbold, 12 years ago
  • added copyright under the Apache License, Version 2.0
File size: 1.8 KB
Line 
1//   Copyright 2012 Georg-August-Universität Göttingen, Germany
2//
3//   Licensed under the Apache License, Version 2.0 (the "License");
4//   you may not use this file except in compliance with the License.
5//   You may obtain a copy of the License at
6//
7//       http://www.apache.org/licenses/LICENSE-2.0
8//
9//   Unless required by applicable law or agreed to in writing, software
10//   distributed under the License is distributed on an "AS IS" BASIS,
11//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//   See the License for the specific language governing permissions and
13//   limitations under the License.
14
15
16package de.ugoe.cs.util.console.defaultcommands;
17
18import static org.junit.Assert.*;
19
20import java.util.ArrayList;
21import java.util.List;
22
23import org.junit.Before;
24import org.junit.Test;
25
26import de.ugoe.cs.util.console.CommandExecuter;
27import de.ugoe.cs.util.console.Console;
28import de.ugoe.cs.util.console.defaultcommands.CMDlistCommands;
29import de.ugoe.cs.util.console.listener.IOutputListener;
30
31public class CMDlistCommandsTest implements IOutputListener {
32
33    private List<String> commands = new ArrayList<String>();
34
35    @Before
36    public void setUp() throws Exception {
37        Console.getInstance().registerOutputListener(this);
38    }
39
40    @Test
41    public void test() {
42        CommandExecuter.getInstance().addCommandPackage("de.ugoe.cs.util.console.defaultcommands");
43        CMDlistCommands command = new CMDlistCommands();
44        command.run(null);
45
46        assertTrue(commands.size() > 0);
47
48        for (String cmd : commands) {
49            assertNotNull(cmd);
50            assertTrue(cmd.length() > 0);
51            System.out.print(cmd);
52        }
53    }
54
55    @Override
56    public void outputMsg(String newMessage) {
57        commands.add(newMessage);
58    }
59
60}
Note: See TracBrowser for help on using the repository browser.