public void testLabelMiner() throws IOException, JSONException, ParseException {
    LabelHandler handler = new LabelHandler();
    Miner miner = new Miner(handler);

    miner.setStartDate(new FdaDate("20140808"));
    miner.processDay();
  }
  public void testEventMiner() throws IOException, JSONException, ParseException {
    EventHandler handler = new EventHandler();
    Miner miner = new Miner(handler);

    miner.setStartDate(new FdaDate("20140115"));
    miner.processDay();
  }
  @Test
  public void test() {
    SessionFactory.initializeForTest();
    LabelHandler handler = new LabelHandler();
    Miner miner = new Miner(handler);

    try {
      ///////////////////////// test miner.query() ///////////////////////////

      // Negative test of query()
      String answer = Miner.query(FAIL_URL);
      assertNull(answer); // Note that query date above must be set to future date.

      // Positive test of query()
      answer = Miner.query(GOOD_URL);
      assertNotNull(answer);

      // get dirty entry
      JSONObject obj = new JSONObject(answer);
      JSONArray results = obj.optJSONArray("results");
      assertNotNull(results);

      JSONObject dirty = results.optJSONObject(0);
      assertNotNull(dirty);

      ///////////////////////// test miner.cleanEntries() ///////////////////////////
      // get clean entry
      JSONArray cleanList = miner.cleanEntries(answer);
      assertNotNull(cleanList);

      JSONObject clean = cleanList.optJSONObject(0);
      assertNotNull(clean);

      boolean fMissing =
          TestLabelHandler.validateRequired(dirty, clean, LabelHandler.REQ_ROOT_KEYS);
      if (fMissing) {
        assertNull(clean);
        return;
      }

      JSONObject fda = dirty.optJSONObject("openfda");
      if (fda == null) {
        assertNull(clean);
        return;
      }

      fMissing = TestLabelHandler.validateRequired(fda, clean, LabelHandler.REQ_FDA_KEYS);
      if (fMissing) {
        assertNull(clean);
        return;
      }

      assertNotNull(clean);

      /*
      ///////////////////////// test miner.saveCleanList() ///////////////////////////
       		long startCount = miner.getCollection().count();
       		miner.saveCleanList( cleanList );
       		long count = miner.getCollection().count();

       		assertTrue( startCount < count );
       		*/

    } catch (IOException e) {
      e.printStackTrace();

    } catch (JSONException e) {
      e.printStackTrace();
    }
  }