Methods Summary |
---|
public static void | main(java.lang.String[] args)
if (args.length == 0){
junit.textui.TestRunner.run(CommandFactoryTest.class);
} else {
junit.textui.TestRunner.run(makeSuite(args));
}
|
private static junit.framework.TestSuite | makeSuite(java.lang.String[] args)
final TestSuite ts = new TestSuite();
for (int i = 0; i < args.length; i++){
ts.addTest(new CommandFactoryTest(args[i]));
}
return ts;
|
private void | nyi()
fail("Not Yet Implemented");
|
protected void | setUp()
|
protected void | tearDown()
|
public void | testInvalidClass()
final ValidCommand vc = new ValidCommand();
vc.setName("vc");
vc.setNumberOfOperands("three");
vc.setUsageText("vc 1 2 3");
vc.setClassName("foobar");
try {
CommandFactory.createCommand(vc, new OptionsMap(), new Vector());
fail("Expected a CommandValidationException indicating that the class could not be found");
}
catch (CommandValidationException cve){
assertEquals("CLI002 Unable to create command object, vc.", cve.getMessage());
assertEquals(ClassNotFoundException.class, cve.getCause().getClass());
assertEquals("foobar", cve.getCause().getMessage()); }
|
public void | testNoArgsConstructor()
final CommandFactory c = new CommandFactory();
|
public void | testNullClass()
final ValidCommand vc = new ValidCommand();
vc.setName("vc");
vc.setNumberOfOperands("three");
vc.setUsageText("vc 1 2 3");
try {
CommandFactory.createCommand(vc, new OptionsMap(), new Vector());
fail("Expected a CommandValidationException indicating that no classname was given");
}
catch (CommandValidationException cve){
assertEquals("CLI001 Invalid Command, vc.", cve.getMessage());
}
|
public void | testSimpleCommandCreation()
final ValidCommand vc = new ValidCommand();
vc.setName("vc");
vc.setNumberOfOperands("three");
vc.setUsageText("vc 1 2 3");
vc.setClassName("com.sun.enterprise.cli.framework.TestCommand");
assertNotNull(vc.getClassName());
final Command c = CommandFactory.createCommand(vc, new OptionsMap(), new Vector());
assertNotNull(c);
|