Exemplo n.º 1
0
  @Test
  public void testMultipleResearchAddressesGetParsed() throws Exception {
    DatabaseModel model = parseTestData(MULTIPLE_RESEARCH_ADDRESSES_TEST_DATA_PATH);
    RowItemContainer<Address> addresses =
        model.getRowItemListOfTypeByDatabaseTableName(ISI.ADDRESS_TABLE_NAME);
    RowItemContainer<Document> documents =
        model.getRowItemListOfTypeByDatabaseTableName(ISI.DOCUMENT_TABLE_NAME);
    RowItemContainer<ResearchAddress> researchAddresses =
        model.getRowItemListOfTypeByDatabaseTableName(ISI.RESEARCH_ADDRESSES_TABLE_NAME);
    RowItemContainer<ReprintAddress> reprintAddresses =
        model.getRowItemListOfTypeByDatabaseTableName(ISI.REPRINT_ADDRESSES_TABLE_NAME);

    checkItemContainerValidity(addresses, "addresses");
    checkItemCount(addresses, 4);
    checkItemContainerValidity(researchAddresses, "research addresses");
    checkItemCount(researchAddresses, 2);
    checkItemContainerValidity(reprintAddresses, "reprint addresses");
    checkItemCount(reprintAddresses, 1);

    Document document = getDocumentForTheseTests(documents);
    ResearchAddress firstResearchAddress =
        getFirstResearchAddress(addresses, researchAddresses, document);
    ResearchAddress secondResearchAddress =
        getSecondResearchAddress(addresses, researchAddresses, document);
    /*ReprintAddress firstReprintAddress =
    	getFirstReprintAddress(addresses, reprintAddresses, document);
    ReprintAddress firstReprintAddress =
    	getFirstReprintAddress(addresses, reprintAddresses, document);*/

    checkResearchAddress(firstResearchAddress);
    checkResearchAddress(secondResearchAddress);
    // checkReprintAddress(firstReprintAddress);
  }
Exemplo n.º 2
0
  @Test
  public void testZeroAddressesGetParsed() throws Exception {
    DatabaseModel model = parseTestData(EMPTY_TEST_DATA_PATH);
    RowItemContainer<Address> addresses =
        model.getRowItemListOfTypeByDatabaseTableName(ISI.ADDRESS_TABLE_NAME);

    checkItemContainerValidity(addresses, "addresses");
    checkItemCount(addresses, 0);
  }
Exemplo n.º 3
0
  @Test
  public void testAddressOfEachGetsParsed() throws Exception {
    DatabaseModel model = parseTestData(ONE_OF_EACH_ADDRESS_TEST_DATA_PATH);
    RowItemContainer<Address> addresses =
        model.getRowItemListOfTypeByDatabaseTableName(ISI.ADDRESS_TABLE_NAME);
    RowItemContainer<Document> documents =
        model.getRowItemListOfTypeByDatabaseTableName(ISI.DOCUMENT_TABLE_NAME);
    RowItemContainer<Publisher> publishers =
        model.getRowItemListOfTypeByDatabaseTableName(ISI.PUBLISHER_TABLE_NAME);
    RowItemContainer<PublisherAddress> publisherAddresses =
        model.getRowItemListOfTypeByDatabaseTableName(ISI.PUBLISHER_ADDRESSES_TABLE_NAME);
    RowItemContainer<ResearchAddress> researchAddresses =
        model.getRowItemListOfTypeByDatabaseTableName(ISI.RESEARCH_ADDRESSES_TABLE_NAME);
    RowItemContainer<ReprintAddress> reprintAddresses =
        model.getRowItemListOfTypeByDatabaseTableName(ISI.REPRINT_ADDRESSES_TABLE_NAME);

    checkItemContainerValidity(addresses, "addresses");
    checkItemCount(addresses, 3);
    checkItemContainerValidity(publisherAddresses, "publisher addresses");
    checkItemCount(publisherAddresses, 1);
    checkItemContainerValidity(researchAddresses, "research addresses");
    checkItemCount(researchAddresses, 1);
    checkItemContainerValidity(reprintAddresses, "reprint addresses");
    checkItemCount(reprintAddresses, 1);

    Document document = getDocumentForTheseTests(documents);
    Publisher publisher = getPublisherForTheseTests(publishers);
    PublisherAddress publisherAddress =
        getPublisherAddress(addresses, publisherAddresses, publisher);
    ResearchAddress firstResearchAddress =
        getFirstResearchAddress(addresses, researchAddresses, document);
    ReprintAddress firstReprintAddress =
        getFirstReprintAddress(addresses, reprintAddresses, document);

    checkPublisherAddress(publisherAddress);
    checkResearchAddress(firstResearchAddress);
    checkReprintAddress(firstReprintAddress);
  }