/*
   * osa 6
   */
  @Points("77.6")
  @Test
  public void manyCards() {
    Main.main(new String[0]);
    String[] rivit = io.getSysOut().split("\n");
    assertTrue("Et tulosta mitään", rivit.length > 0);
    for (String rivi : rivit) {
      assertTrue(
          "Print card info and owner name of card at the same line."
              + "Remove possible extra code from main()",
          rivi.toLowerCase().contains("pek") || rivi.toLowerCase().contains("bri"));
      assertFalse(
          "Print only one card info per line. Now you print line " + rivi,
          rivi.toLowerCase().contains("pek") && rivi.toLowerCase().contains("bri"));
    }
    ArrayList<String> pekka = new ArrayList<String>();
    ArrayList<String> matti = new ArrayList<String>();
    for (String rivi : rivit) {
      if (rivi.toLowerCase().contains("bri")) {
        matti.add(rivi);
      } else if (rivi.toLowerCase().contains("pek")) {
        pekka.add(rivi);
      }
    }

    tarkastaMatinRivit(matti);
    tarkastaPekanRivit(pekka);
  }
Exemplo n.º 2
0
 /**
  * Load a gui with the specified genome file. No genome is loaded if null
  *
  * @param genomeFile
  * @return
  * @throws IOException
  */
 protected static IGV startGUI(String genomeFile) throws IOException {
   Globals.setHeadless(false);
   IGV igv;
   // If IGV is already open, we get the instance.
   if (IGV.hasInstance()) {
     igv = IGV.getInstance();
     IGV.getMainFrame().setVisible(true);
     System.out.println("Using old IGV");
   } else {
     JFrame frame = new JFrame();
     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     Main.open(frame);
     System.out.println("Started new IGV");
     igv = IGV.getInstance();
     assertTrue(IGV.getInstance().waitForNotify(1000));
   }
   if (genomeFile != null) {
     igv.loadGenome(genomeFile, null);
     genome = igv.getGenomeManager().getCurrentGenome();
   }
   return igv;
 }