@Test public void should_fail_if_visible_JSpinner_not_found_by_type() { thrown.expect(ComponentLookupException.class); thrown.expectMessageToContain( "Unable to find component using matcher", "type=javax.swing.JSpinner, requireShowing=true"); fixture.spinner(); }
@Test public void should_find_visible_JSpinner_by_Matcher() { robot.showWindow(window); JSpinnerFixture spinner = fixture.spinner( new GenericTypeMatcher<JSpinner>(JSpinner.class) { @Override protected boolean isMatching(@Nonnull JSpinner s) { return s.getValue().equals(8); } }); assertThat(spinner.target()).isSameAs(window.spinner); }
@Test public void should_fail_if_visible_JSpinner_not_found_by_Matcher() { thrown.expect(ComponentLookupException.class); thrown.expectMessageToContain("Unable to find component using matcher"); fixture.spinner(neverMatches(JSpinner.class)); }
@Test public void should_find_visible_JSpinner_by_type() { robot.showWindow(window); JSpinnerFixture spinner = fixture.spinner(); assertThat(spinner.target()).isSameAs(window.spinner); }