Exemplo n.º 1
0
 @Test
 public void testGetResults() throws Exception {
   GetResults res = new GetResults();
   Lotto6aus9LotteryResults results;
   LotteryResultsLoader loader =
       new JSONLotteryResultsLoader<Lotto6aus9LotteryResults>(
           LOTTO6AUS9_RESULTS_FILE, Lotto6aus9LotteryResults.class);
   try {
     results = (Lotto6aus9LotteryResults) loader.load();
   } catch (Exception e) {
     results = new Lotto6aus9LotteryResults();
   }
   GCIDList gciDs = res.getGCIDs(new Lotto6aus49(), "2016");
   //        gciDs.top(3);
   int i = 0;
   for (GCID g : gciDs) {
     i++;
     if (!results.isStored(g)) {
       System.out.println("Getting new result [ " + i + " / " + gciDs.size() + " ]");
       Lotto6aus49 l69 = new Lotto6aus49();
       l69.getResult(g);
       l69.printResult();
       results.add(l69);
     }
   }
   loader.save(results);
   System.out.print("Count of results: " + results.getGames().size());
 }