SpinnerValueProperty extends IntProperty implements ChangeListener { @NotNull @Override public Integer get() { return mySpinner.getNumber(); } SpinnerValueProperty(@NotNull JBIntSpinner spinner); @Override void stateChanged(ChangeEvent e); @NotNull @Override Integer get();  }
@Test public void testSliderValueProperty() throws Exception { JBIntSpinner spinner = new JBIntSpinner(111, Integer.MIN_VALUE, Integer.MAX_VALUE); SpinnerValueProperty spinnerValue = new SpinnerValueProperty(spinner); CountListener listener = new CountListener(); spinnerValue.addListener(listener); assertThat(spinnerValue.get()).isEqualTo(111); assertThat(listener.getCount()).isEqualTo(0); spinner.setNumber(222); assertThat(spinnerValue.get()).isEqualTo(222); assertThat(listener.getCount()).isEqualTo(1); spinner.setNumber(333); assertThat(spinnerValue.get()).isEqualTo(333); assertThat(listener.getCount()).isEqualTo(2); spinnerValue.set(444); assertThat(spinner.getValue()).isEqualTo(444); assertThat(spinner.getNumber()).isEqualTo(444); assertThat(listener.getCount()).isEqualTo(3); }