@Test
  public void verifyMockDataIsInTable() {
    // find ted frame
    FrameFinder frameFinder = new FrameFinder("ted");
    JFrame frame = (JFrame) frameFinder.find(0);
    assertNotNull("Did not find 'ted' JFRame", frame);

    // init finder
    NamedComponentFinder finder = new NamedComponentFinder(JComponent.class, "");

    // find show list in main dialog
    finder.setName("showTable");
    TedTable seriesTable = (TedTable) finder.find(frame, 0);
    assertNotNull("Could not find series table", seriesTable);

    // click first row
    JTableMouseEventData seriesTableClickEvent =
        new JTableMouseEventData(this, seriesTable, 0, 0, 1);
    getHelper().enterClickAndLeave(seriesTableClickEvent);

    // update seriesTable now that it's been clicked
    seriesTable = (TedTable) finder.find(frame, 0);

    // get text of first row
    Show selectedShow = seriesTable.getSelectedShow();

    // assert equality
    assertEquals("The fixture data is incorrect.", "My Show", selectedShow.getName());
  }
Пример #2
0
 private JComponent findComponent(Class c, String name, boolean shouldAssert) {
   finder.setComponentClass(c);
   finder.setName(name);
   JComponent comp = (JComponent) finder.find(testPanel, 0);
   if (shouldAssert) {
     assertNotNull("Could not find the " + c.getName() + " named " + name, comp);
   }
   return comp;
 }
  @Test
  public void testRemoveShowWithMenuButton() {
    // find ted frame
    FrameFinder frameFinder = new FrameFinder("ted");
    JFrame frame = (JFrame) frameFinder.find(0);
    assertNotNull("Did not find 'ted' JFRame", frame);

    // init finder
    NamedComponentFinder finder = new NamedComponentFinder(JComponent.class, "");

    // find show list in main dialog
    finder.setName("showTable");
    TedTable seriesTable = (TedTable) finder.find(frame, 0);
    assertNotNull("Could not find series table", seriesTable);

    // click first row
    JTableMouseEventData seriesTableClickEvent =
        new JTableMouseEventData(this, seriesTable, 0, 0, 1);
    getHelper().enterClickAndLeave(seriesTableClickEvent);

    // update seriesTable now that it's been clicked
    seriesTable = (TedTable) finder.find(frame, 0);

    // find the menu button
    finder.setName("TedTooBarDeleteShowButton");
    TedMainToolBarButton deleteButton = (TedMainToolBarButton) finder.find(frame, 0);
    assertNotNull("Could not find delete button", deleteButton);

    // click the menu button
    getHelper().enterClickAndLeave(new MouseEventData(this, deleteButton));

    /** @todo jfcUnit is having problems detecting JOptionPane */
    // Answer 'Yes' to dialog
    //		DialogFinder dialogFinder = new DialogFinder("ted");
    //		System.out.println(dialogFinder.findAll());
    //
    //		// ensure table is empty
    //		assertEquals("Number of shows does not match", 0, this.main
    //				.getSerieTable().getSeries().size());
    //
    //		// ensure show file is empty
    //		Vector<?> shows = TedIO.getInstance().GetShows();
    //		assertEquals("Number of shows does not match", 0, shows.size());
  }