manager.load(TOOLBOX_PATH);
toolbox = manager.getToolbox(null);
}
public @Test void testAlternatorTool() {
AlternatorTool alternatorTool = (AlternatorTool)toolbox.get("alternator");
assertNotNull(alternatorTool);
/* test automatic alternator */
Alternator auto = alternatorTool.auto(new String[] {"red","blue","yellow"});
assertEquals("red",auto.getCurrent());
assertEquals("red",auto.getNext());
assertEquals("blue",auto.toString());
assertEquals("yellow",auto.toString());
assertEquals("red",auto.toString());
/* test manual alternator (use 'make()' and not 'manual()' since we define the default to be manual in toolbox.xml*/
Alternator manual = alternatorTool.make(new String[] {"red","blue","yellow"});
assertEquals("red",manual.toString());
assertEquals("red",manual.toString());
manual.shift();
assertEquals("blue",manual.toString());
manual.shift();