@Test
  public void testResolveSingle() throws ResolverException {
    config1.setX509TrustEngine(controlTrustEngine1);
    config1.setCertificateNameOptions(controlNameOpts1);

    ClientTLSValidationParameters params = resolver.resolveSingle(criteriaSet);

    Assert.assertNotNull(params);
    Assert.assertTrue(params.getX509TrustEngine() == controlTrustEngine1);
    Assert.assertTrue(params.getCertificateNameOptions() == controlNameOpts1);
  }
  @Test
  public void testResolveTrustEngine() {
    TrustEngine<? super X509Credential> trustEngine;

    trustEngine = resolver.resolveTrustEngine(criteriaSet);
    Assert.assertNull(trustEngine);

    config1.setX509TrustEngine(controlTrustEngine1);
    config2.setX509TrustEngine(controlTrustEngine2);
    config3.setX509TrustEngine(controlTrustEngine3);

    trustEngine = resolver.resolveTrustEngine(criteriaSet);
    Assert.assertTrue(trustEngine == controlTrustEngine1);

    config1.setX509TrustEngine(null);

    trustEngine = resolver.resolveTrustEngine(criteriaSet);
    Assert.assertTrue(trustEngine == controlTrustEngine2);

    config2.setX509TrustEngine(null);

    trustEngine = resolver.resolveTrustEngine(criteriaSet);
    Assert.assertTrue(trustEngine == controlTrustEngine3);
  }
  @Test
  public void testResolveNameOptions() {
    CertificateNameOptions nameOpts;

    nameOpts = resolver.resolveNameOptions(criteriaSet);
    Assert.assertNull(nameOpts);

    config1.setCertificateNameOptions(controlNameOpts1);
    config2.setCertificateNameOptions(controlNameOpts2);
    config3.setCertificateNameOptions(controlNameOpts3);

    nameOpts = resolver.resolveNameOptions(criteriaSet);
    Assert.assertTrue(nameOpts == controlNameOpts1);

    config1.setCertificateNameOptions(null);

    nameOpts = resolver.resolveNameOptions(criteriaSet);
    Assert.assertTrue(nameOpts == controlNameOpts2);

    config2.setCertificateNameOptions(null);

    nameOpts = resolver.resolveNameOptions(criteriaSet);
    Assert.assertTrue(nameOpts == controlNameOpts3);
  }
  @Test
  public void testResolve() throws ResolverException {
    config1.setX509TrustEngine(controlTrustEngine1);
    config1.setCertificateNameOptions(controlNameOpts1);

    Iterable<ClientTLSValidationParameters> paramsIter = resolver.resolve(criteriaSet);
    Assert.assertNotNull(paramsIter);

    Iterator<ClientTLSValidationParameters> iterator = paramsIter.iterator();
    Assert.assertNotNull(iterator);

    Assert.assertTrue(iterator.hasNext());

    ClientTLSValidationParameters params = iterator.next();

    Assert.assertNotNull(params);
    Assert.assertTrue(params.getX509TrustEngine() == controlTrustEngine1);
    Assert.assertTrue(params.getCertificateNameOptions() == controlNameOpts1);

    Assert.assertFalse(iterator.hasNext());
  }
 @Test(expectedExceptions = ConstraintViolationException.class)
 public void testAbsentCriterion() throws ResolverException {
   resolver.resolve(new CriteriaSet());
 }
 @Test(expectedExceptions = ConstraintViolationException.class)
 public void testNullCriteriaSet() throws ResolverException {
   resolver.resolve(null);
 }