コード例 #1
0
  /**
   * Creates a scenario where the fetcher does not retrieve an entry on its first attempt. If the
   * enricher re-queries the fetcher, it will eventually receive the entry.
   *
   * @throws EnricherException
   */
  @Test
  public void test_bridgeFailure_does_not_throw_exception_when_not_persistent()
      throws EnricherException {

    persistentBioactiveEntity = new DefaultBioactiveEntity(TEST_SHORTNAME, TEST_FULLNAME);
    persistentBioactiveEntity.setChebi(CHEBI_ID);

    int timesToTry = 3;
    assertTrue(
        "The test can not be applied as the conditions do not invoke the required response. "
            + "Change the timesToTry.",
        timesToTry < 5);

    FailingBioactiveEntityFetcher fetcher = new FailingBioactiveEntityFetcher(timesToTry);
    fetcher.addEntry(CHEBI_ID, Collections.singleton(persistentBioactiveEntity));
    enricher = new FullBioactiveEntityUpdater(fetcher);

    enricher.enrich(persistentBioactiveEntity);

    assertEquals(TEST_FULLNAME, persistentBioactiveEntity.getFullName());
  }