@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()); }
public TestRemoveShowContract() { Show fakeShow = new Show(); fakeShow.setName("My Show"); mockShows.add(fakeShow); String fileName = TedSystemInfo.getUserDirectory() + "shows.ted"; System.out.println("Shows.ted location: " + fileName); File showFile = new File(fileName); if (showFile.exists()) { System.out.println("Deleting shows.ted to ensure fresh start..."); showFile.delete(); } TedIO.getInstance().SaveShows(this.mockShows); junit.extensions.jfcunit.WindowMonitor.start(); this.main = new TedMainDialogController(false, true); this.main.setViewVisible(true); try { setHelper(new RobotTestHelper()); } catch (AWTException e) { fail("AWTException occurred, we can't go on! Message: " + e.getMessage()); } }
@Test public void verifyMockData() { Vector<?> shows = TedIO.getInstance().GetShows(); assertEquals("Number of shows does not match", 1, shows.size()); Show show = (Show) shows.get(0); assertEquals("Show title does not match", "My Show", show.getName()); }
public void run() { // loading... showInfoPane.setText( startHTML + Lang.getString("TedAddShowDialog.ShowInfo.LabelLoadingInfo") + endHTML); // when a show is selected if (currentShow != null && !done) { // and has a TV.com url String id = p.gettvID(currentShow.getName()); if (!id.equals("")) { URL url; try { String location = p.getHostUrl(); if (!location.equals("") && !done) { // open the showinfo url and display url = new URL(location + id); showInfoPane.setPage(url); } else { TedLog.error("shows.xml file is corrupt"); } } catch (MalformedURLException e) { // url malformed, display error showInfoPane.setText( startHTML + Lang.getString("TedAddShowDialog.ShowInfo.ErrorMalformedURL") + endHTML); } catch (IOException e) { // url not found, display error showInfoPane.setText( startHTML + Lang.getString("TedAddShowDialog.ShowInfo.ErrorIO") + endHTML); } catch (Exception e) { // unkown error, display error and print stacktrace showInfoPane.setText( startHTML + Lang.getString("TedAddShowDialog.ShowInfo.ErrorUnknown") + endHTML); e.printStackTrace(); } } else { // no info url available showInfoPane.setText( startHTML + Lang.getString("TedAddShowDialog.ShowInfo.LabelNoInfo") + endHTML); } } }