ModeDetector { public static Mode detect(X509Certificate certificate) throws PeppolLoadingException { return detect(certificate, ConfigFactory.load(), null); }  static Mode detect(X509Certificate certificate); static Mode detect(X509Certificate certificate, Config config, Map<String, Object> objectStorage);  }
@Test public void simpleDetectTest() throws Exception { X509Certificate certificate = Validator.getCertificate(getClass().getResourceAsStream("/ap-difi-test.cer")); Assert.assertEquals(ModeDetector.detect(certificate).getString("security.pki"), "/pki/peppol-test.xml"); }
@Test public void simpleDetectLocal() throws Exception { X509Certificate certificate = Validator.getCertificate(getClass().getResourceAsStream("/self-signed.cer")); Assert.assertEquals(ModeDetector.detect(certificate).getString("security.pki"), "/pki/local.xml"); }
@Test(expectedExceptions = PeppolLoadingException.class) public void simpleDetectError() throws Exception { X509Certificate certificate = Validator.getCertificate(getClass().getResourceAsStream("/web-difi.cer")); ModeDetector.detect(certificate).getString("security.pki"); }
@Test(enabled = false) public void simpleDetectProduction() throws Exception { X509Certificate certificate = Validator.getCertificate(getClass().getResourceAsStream("/ap-difi-prod.cer")); Assert.assertEquals(ModeDetector.detect(certificate).getString("security.pki"), "/pki/peppol-production.xml"); }