Ejemplo n.º 1
0
  /** Test the replacement of data given the same id */
  @Test
  public void testIdReplacement() {
    log.debug("Entering PseudonymMapTest.testIdReplacement");
    // pseudonymMap for this Id should previously exist and return the old one
    PseudonymMap prevMap = PseudonymMapManager.addPseudonymMap(pseudonymMap_2);
    assertNotNull(prevMap);
    // and should be the same as what we created previously
    assertEquals(pseudonymMap_1.toString(), prevMap.toString());

    // pseudonymMap for this Id should not previously exist
    PseudonymMap newMap = PseudonymMapManager.addPseudonymMap(pseudonymMap_3);
    assertNull(newMap);

    PseudonymMapManager.writeMap();
    PseudonymMapManager.readMap();

    PseudonymMap searchMap =
        PseudonymMapManager.findPseudonymMap(pseudoAuthorityId_2, pseudoPatientId_2);
    // pseudonymMap should be located
    assertNotNull(searchMap);
    // and should be the same as what we created previously as 2
    assertEquals(pseudonymMap_2.toString(), searchMap.toString());

    searchMap = PseudonymMapManager.findPseudonymMap(pseudoAuthorityId_3, pseudoPatientId_3);
    // pseudonymMap should be located
    assertNotNull(searchMap);
    // and should be the same as what we created previously as 3
    assertEquals(pseudonymMap_3.toString(), searchMap.toString());

    log.debug("Exiting PseudonymMapTest.testIdReplacement");
  }
Ejemplo n.º 2
0
  /** Test the creation of a Pseudonym Map XML file and the extraction of a stored map */
  @Test
  public void testStoreRetrieve() {
    log.debug("Entering PseudonymMapTest.testStoreRetrieve");
    // pseudonymMap should not previously exist
    assertNull(PseudonymMapManager.addPseudonymMap(pseudonymMap_1));
    PseudonymMapManager.writeMap();
    PseudonymMapManager.readMap();
    PseudonymMap searchMap =
        PseudonymMapManager.findPseudonymMap(pseudoAuthorityId_1, pseudoPatientId_1);

    // pseudonymMap should be located
    assertNotNull(searchMap);

    // and should be the same as what we created previously
    assertEquals(pseudonymMap_1.toString(), searchMap.toString());
    log.debug("Exiting PseudonymMapTest.testStoreRetrieve");
  }