/**
* Execute this command
*/
public void execute() {
TestManager mgr = TestManager.getInstance();
if (FLAG_LIST.isSet()) {
PrintWriter out = getOutput().getPrintWriter();
for (Class<? extends Test> test : mgr.getTests()) {
out.print(test.getName() + " :");
for (String category : mgr.getCategories(test)) {
out.print(" ");
out.print(category);
}
out.println();
}
} else if (FLAG_RUN.isSet()) {
String[] categories = ARG_CATEGORY.getValues();
if (categories == null) {
categories = new String[0];
}
TestSuite suite = mgr.getTestSuite(Arrays.asList(categories));
junit.textui.TestRunner.run(suite);
}
}