@Test
  public void testGetIdentifier_newEqual() {

    String pairwise1 = service.getIdentifier(userInfoRegular, pairwiseClient1);
    Mockito.verify(pairwiseIdentifierRepository, Mockito.atLeast(1))
        .save(Matchers.any(PairwiseIdentifier.class));

    PairwiseIdentifier pairwiseId = new PairwiseIdentifier();
    pairwiseId.setUserSub(regularSub);
    pairwiseId.setIdentifier(pairwise1);
    pairwiseId.setSectorIdentifier(sectorHost12);

    Mockito.when(pairwiseIdentifierRepository.getBySectorIdentifier(regularSub, sectorHost12))
        .thenReturn(pairwiseId);

    String pairwise2 = service.getIdentifier(userInfoRegular, pairwiseClient2);

    assertNotSame(pairwiseSub, pairwise1);
    assertNotSame(pairwiseSub, pairwise2);

    assertEquals(pairwise1, pairwise2);

    // see if the pairwise id's are actual UUIDs
    UUID uudi1 = UUID.fromString(pairwise1);
    UUID uuid2 = UUID.fromString(pairwise2);
  }
  @Before
  public void prepare() {
    userInfoRegular = new DefaultUserInfo();
    userInfoRegular.setPreferredUsername(regularUsername);
    userInfoRegular.setSub(regularSub);

    // pairwise set 1
    pairwiseClient1 = ModelFactory.instance().getClientDetailsInstance();
    pairwiseClient1.setClientId(pairwiseClientId1);
    pairwiseClient1.setSubjectType(SubjectType.PAIRWISE);
    pairwiseClient1.setSectorIdentifierUri(sectorIdentifier1);

    pairwiseClient2 = ModelFactory.instance().getClientDetailsInstance();
    pairwiseClient2.setClientId(pairwiseClientId2);
    pairwiseClient2.setSubjectType(SubjectType.PAIRWISE);
    pairwiseClient2.setSectorIdentifierUri(sectorIdentifier2);

    // pairwise set 2
    pairwiseClient3 = ModelFactory.instance().getClientDetailsInstance();
    pairwiseClient3.setClientId(pairwiseClientId3);
    pairwiseClient3.setSubjectType(SubjectType.PAIRWISE);
    pairwiseClient3.setSectorIdentifierUri(sectorIdentifier3);
    pairwiseClient3.setRedirectUris(pairwiseClient3RedirectUris);

    // pairwise with null sector
    pairwiseClient4 = ModelFactory.instance().getClientDetailsInstance();
    pairwiseClient4.setClientId(pairwiseClientId4);
    pairwiseClient4.setSubjectType(SubjectType.PAIRWISE);
    pairwiseClient4.setRedirectUris(pairwiseClient4RedirectUris);

    // pairwise with multiple redirects and no sector (error)
    pairwiseClient5 = ModelFactory.instance().getClientDetailsInstance();
    pairwiseClient5.setClientId(pairwiseClientId5);
    pairwiseClient5.setSubjectType(SubjectType.PAIRWISE);
    pairwiseClient5.setRedirectUris(pairwiseClient5RedirectUris);

    // saved pairwise identifier from repository
    savedPairwiseIdentifier = new PairwiseIdentifier();
    savedPairwiseIdentifier.setUserSub(regularSub);
    savedPairwiseIdentifier.setIdentifier(pairwiseSub);
    savedPairwiseIdentifier.setSectorIdentifier(sectorHost12);
  }