@Test
  public void testFetchLatest() {
    Date from;

    from = new GregorianCalendar(2011, 7, 22, 7, 0, 0).getTime();
    junit.framework.Assert.assertEquals(16, subject.fetch(channel, from).size());

    from = new GregorianCalendar(2011, 7, 21, 12, 50, 0).getTime();
    junit.framework.Assert.assertEquals(18, subject.fetch(channel, from).size());
  }
예제 #2
0
  /** test methods that return Map of ids to Records and no sysout stuff */
  @Test
  public void testGettingOutputAsMapOfRecords() throws IOException {
    String mhldRecFileName = testDataParentPath + File.separator + "summaryHld_1-1000.mrc";
    String bibRecFileName = testDataParentPath + File.separator + "u335.mrc";

    Map<String, Record> mergedRecs =
        MergeSummaryHoldings.mergeMhldsIntoBibRecordsAsMap(bibRecFileName, mhldRecFileName);

    junit.framework.Assert.assertEquals("results should have 1 record", 1, mergedRecs.size());
    String expId = "u335";
    assertTrue("Record with id " + expId + " should be in results", mergedRecs.containsKey(expId));

    Record resultRec = mergedRecs.get(expId);
    RecordTestingUtils.assertEqualsIgnoreLeader(mergedSummaryHoldingsOutputNoUmlaut, resultRec);
    System.out.println("Test testGettingOutputAsMapOfRecords() successful");
  }
  @Test
  public void testMapping() throws Exception {
    List<Article> articleList;
    Article article;

    articleList = subject.fetch(channel, new Date(0));

    junit.framework.Assert.assertEquals(false, articleList.isEmpty());

    article = articleList.get(0);

    junit.framework.Assert.assertEquals("title", article.getTitle());
    junit.framework.Assert.assertEquals("description", article.getDescription());
    junit.framework.Assert.assertEquals("http://link", article.getLink());
    junit.framework.Assert.assertEquals(
        new GregorianCalendar(2011, 7, 22, 10, 32, 26).getTime(), article.getPublished());
    junit.framework.Assert.assertEquals(
        channel.getUrl().toURI().toURL().toExternalForm(), article.getSource());
  }