@Test public void should_Fail_If_Visible_JButton_Not_Found_By_Type() { thrown.expect(ComponentLookupException.class); thrown.expectMessageToContain( "Unable to find component using matcher", "type=javax.swing.JSplitPane, requireShowing=true"); fixture.splitPane(); }
@Test public void should_Find_Visible_JButton_By_Matcher() { robot.showWindow(window); JSplitPaneFixture splitPane = fixture.splitPane( new GenericTypeMatcher<JSplitPane>(JSplitPane.class) { @Override protected boolean isMatching(@Nonnull JSplitPane s) { return s.getLeftComponent() instanceof JList; } }); assertThat(splitPane.target()).isSameAs(window.splitPane); }
@Test public void should_Find_Visible_JButton_By_Type() { robot.showWindow(window); JSplitPaneFixture splitPane = fixture.splitPane(); assertThat(splitPane.target()).isSameAs(window.splitPane); }
@Test public void should_Fail_If_Visible_JButton_Not_Found_By_Matcher() { thrown.expect(ComponentLookupException.class); thrown.expectMessageToContain("Unable to find component using matcher"); fixture.splitPane(neverMatches(JSplitPane.class)); }