@Test
public void testDoCommand() {

    FooTarget foo = new FooTarget();
    BarTarget bar = new BarTarget();
    TargetManager manager = TargetManager.getInstance();
    // set explicit targets
    manager.setTarget(foo);
    assertTrue(manager.doCommand("foo", null));
    assertFalse(manager.doCommand("bar", null));
    manager.setTarget(bar);
    assertTrue(manager.doCommand("bar", null));
    assertFalse(manager.doCommand("foo", null));
    // Add both of the targets all commands are valid
    manager.setTarget(null);
    manager.addTarget(foo);
    manager.addTarget(bar);
    assertTrue(manager.doCommand("bar", null));
    assertTrue(manager.doCommand("foo", null));
}