SoarBeanOutputManager { public <T> void registerHandler(String name, SoarBeanOutputHandler<T> handler, Class<T> beanClass) { handlers.put(name, new HandlerInfo(handler, beanClass)); } SoarBeanOutputManager(SoarEventManager eventManager); void dispose(); void registerHandler(String name, SoarBeanOutputHandler<T> handler, Class<T> beanClass); void unregisterHandler(String name);  }
@Test public void testRegisterHandler() throws Exception { final ByRef<MoveToPoint> commandHolder = ByRef.create(null); final SoarBeanOutputHandler<MoveToPoint> handler = new SoarBeanOutputHandler<MoveToPoint>() { @Override public void handleOutputCommand(SoarBeanOutputContext context, MoveToPoint bean) { assertEquals("move-to-point", context.getCommand().getAttribute().toString()); assertSame(agent.getInputOutput(), context.getInputOutput()); commandHolder.value = bean; context.setStatus("all done"); }}; output.registerHandler("move-to-point", handler, MoveToPoint.class); agent.getProductions().loadProduction("testRegisterHandler\n" + "(state <s> ^superstate nil ^io.output-link <ol>)" + "-->\n" + "(<ol> ^move-to-point <mtp>)\n" + "(<mtp> ^speed 5 ^target <tgt>)\n" + "(<tgt> ^x 1 ^y 2)\n" + ""); agent.runFor(1, RunType.DECISIONS); assertNotNull(commandHolder.value); assertEquals(5.0, commandHolder.value.speed, 0.00001); final Point target = commandHolder.value.target; assertNotNull(target); assertEquals(1, target.x); assertEquals(2, target.y); commandHolder.value = null; agent.runFor(1, RunType.DECISIONS); assertNull(commandHolder.value); }