@Test public void testMaintainer() { Collector front = RobotContext.Get().getCollectionCore().getFrontCollector(); OICore oi = this.context.GetOICore(); RollerListenerWorker worker = new RollerListenerWorker(front, "Front"); worker.init(); oi.setRollerShouldExpel(false); oi.setRollerShouldIntake(false); worker.exec(); assertEquals( "Collector roller power should be zero", 0, front.getCollectorRollerMotor(), 0.001); oi.setRollerShouldIntake(true); oi.setRollerShouldExpel(false); worker.exec(); assertTrue( "Collector roller powre should be be above zero", front.getCollectorRollerMotor() > 0); oi.setRollerShouldIntake(false); oi.setRollerShouldExpel(true); worker.exec(); assertTrue( "Collector roller powre should be be above zero", front.getCollectorRollerMotor() < 0); oi.setRollerShouldIntake(true); oi.setRollerShouldExpel(true); worker.exec(); assertEquals( "Collector roller power should be zero", 0, front.getCollectorRollerMotor(), 0.001); }
@Test public void failureWhenNotSafe() { collector.getSensors().SetScaledPositionTESTONLY(0); assertEquals(ExecState.FAILURE, worker.isFinished()); }
@Test public void successWhenAlreadySafe() { collector.getSensors().SetScaledPositionTESTONLY(1.0); assertEquals(ExecState.SUCCESS, worker.isFinished()); }
@Test public void successWhenManual() { collector.setIsManual(true); assertEquals(ExecState.SUCCESS, worker.isFinished()); }
@Before public void setUp() { collector.setIsManual(false); worker = new IsArmSafeToFireWorker(collector); }