@@ -0,0 +1,2604 @@
+package com.easternedgerobotics.rov.io.joystick;%0A%0Aimport com.easternedgerobotics.rov.test.TestEventPublisher;%0Aimport com.easternedgerobotics.rov.value.VideoFlipValueA;%0Aimport com.easternedgerobotics.rov.value.VideoFlipValueB;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.junit.runners.Parameterized;%0Aimport org.junit.runners.Parameterized.Parameters;%0Aimport org.mockito.Matchers;%0Aimport org.mockito.Mockito;%0Aimport rx.Observable;%0Aimport rx.observers.TestSubscriber;%0Aimport rx.schedulers.TestScheduler;%0Aimport rx.subjects.TestSubject;%0A%0Aimport java.util.Arrays;%0Aimport java.util.Collection;%0Aimport java.util.function.Function;%0A%0A@RunWith(Parameterized.class)%0Apublic final class JoystickControllerButtonTest %7B%0A    @Parameters(name = %22Joystick button #%7B0%7D should emit a value of %7B1%7D%22)%0A    public static Collection%3CObject%5B%5D%3E data() %7B%0A        return Arrays.asList(new Object%5B%5D%5B%5D %7B%0A            %7BJoystickController.CAMERA_A_VIDEO_FLIP_JOYSTICK_BUTTON, VideoFlipValueA.class%7D,%0A            %7BJoystickController.CAMERA_B_VIDEO_FLIP_JOYSTICK_BUTTON, VideoFlipValueB.class%7D,%0A        %7D);%0A    %7D%0A%0A    private final int index;%0A%0A    private final Class clazz;%0A%0A    public JoystickControllerButtonTest(final int index, final Class clazz) %7B%0A        this.index = index;%0A        this.clazz = clazz;%0A    %7D%0A%0A    @SuppressWarnings(%22unchecked%22)%0A    @Test%0A    public void buttonPressDoesEmitSingleValueOfCorrectType() %7B%0A        final TestScheduler scheduler = new TestScheduler();%0A        final TestSubscriber subscriber = new TestSubscriber();%0A        final TestSubject subj = TestSubject.create(scheduler);%0A        final TestEventPublisher eventPublisher = new TestEventPublisher(scheduler);%0A        final JoystickController joystickController = new JoystickController(eventPublisher, Function.identity());%0A%0A        final Joystick joystick = Mockito.mock(Joystick.class);%0A        Mockito.when(joystick.axes())%0A            .thenReturn(Observable.never());%0A        Mockito.when(joystick.button(Matchers.intThat(argument -%3E !argument.equals(index))))%0A            .thenReturn(Observable.never());%0A        Mockito.when(joystick.button(Mockito.eq(index)))%0A            .thenReturn(subj);%0A%0A        joystickController.onNext(joystick);%0A%0A        eventPublisher.valuesOfType(clazz).subscribe(subscriber);%0A        subj.onNext(Joystick.BUTTON_DOWN);%0A        subj.onNext(Joystick.BUTTON_UP);%0A        scheduler.triggerActions();%0A%0A        subscriber.assertValueCount(1);%0A        Assert.assertTrue(%22Emitted type is not correct%22, subscriber.getOnNextEvents().get(0).getClass().equals(clazz));%0A    %7D%0A%7D%0A

Add joystick controller button tests