@Test
    public void keepsCorrectValueOnNewValues() {
        final CallCounter cc = new CallCounter();
        final TextSpinner<Integer> ts = new TextSpinner<Integer>()
                .setValues(Arrays.asList(1, 2, 3))
                .setChangeListener(cc::callWith);

        ts.set(3);
        assertThat(ts.get()).isEqualTo(3);
        assertThat(ts.getValues()).isEqualTo(Arrays.asList(1, 2, 3));
        assertThat(cc.getCnt()).isEqualTo(1);
        assertThat(cc.getLastValue()).isEqualTo(3);
        cc.reset();

        //setting a value not in list has NO effect
        ts.set(5);
        assertThat(ts.get()).isEqualTo(3);
        assertThat(ts.getValues()).isEqualTo(Arrays.asList(1, 2, 3));
        assertThat(cc.getCnt()).isEqualTo(0);
        cc.reset();

        //set new values where "3" is not at a different place
        ts.setValues(Arrays.asList(1, 3, 2, 4));
        assertThat(ts.get()).isEqualTo(3);
        assertThat(ts.getValues()).isEqualTo(Arrays.asList(1, 3, 2, 4));
        assertThat(cc.getCnt()).isEqualTo(0); // no call to change listeneger, value has not changed
        cc.reset();

        //set new values where "3" is no longer contained -> should reset to first list value
        ts.setValues(Arrays.asList(1, 2, 4));
        assertThat(ts.get()).isEqualTo(1);
        assertThat(ts.getValues()).isEqualTo(Arrays.asList(1, 2, 4));
        assertThat(cc.getCnt()).isEqualTo(1);
        assertThat(cc.getLastValue()).isEqualTo(1);
        cc.reset();
    }
This can, of course, only test the non-ui-parts of the {@link TextSpinner}
main/src/test/java/cgeo/geocaching/ui/TextSpinnerTest.java