test_class.declarator: log = LoggerFactory.getLogger(X509CertificateUtilTest.class)
test_class.modifier: private final static
test_class.original_string: private final static Logger log = LoggerFactory.getLogger(X509CertificateUtilTest.class);
test_class.type: Logger
test_class.var_name: log
test_class.file: commons/components/commons-mule/src/test/java/org/soitoolkit/commons/mule/cert/X509CertificateUtilTest.java
test_class.identifier: X509CertificateUtilTest
test_case.body: @Test
  	public void getPropertyFromX500PrincipalNoPrincipalProperty() {
  		X509Certificate cert = mock(X509Certificate.class);
  		X500Principal principal = new X500Principal("OU=JavaSoft, O=Sun Microsystems, C=US");
  		
  		when(cert.getSubjectX500Principal()).thenReturn(principal);
  		
  		try {
  			X509CertificateUtil.getPropertyFromX500Principal(cert, "CN");
  			fail();
  		} catch (Exception e) {
  			assertEquals("Principal property CN not found in Certificate", e.getMessage());
  		}
  	}
test_case.class_method_signature: X509CertificateUtilTest.getPropertyFromX500PrincipalNoPrincipalProperty()
test_case.full_signature: @Test public void getPropertyFromX500PrincipalNoPrincipalProperty()
test_case.identifier: getPropertyFromX500PrincipalNoPrincipalProperty
test_case.invocations: mock thenReturn when getSubjectX500Principal getPropertyFromX500Principal fail assertEquals getMessage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getPropertyFromX500PrincipalNoPrincipalProperty()
focal_class.declarator: log = LoggerFactory.getLogger(X509CertificateUtil.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(X509CertificateUtil.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.file: commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/cert/X509CertificateUtil.java
focal_class.identifier: X509CertificateUtil
focal_class.class_method_signature: X509CertificateUtil.X509CertificateUtil()
focal_class.full_signature: private  X509CertificateUtil()
focal_class.identifier: X509CertificateUtil
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  X509CertificateUtil()
focal_class.class_method_signature: X509CertificateUtil.getPropertyFromX500Principal(X509Certificate cert, String propertyName)
focal_class.full_signature: public static String getPropertyFromX500Principal(X509Certificate cert, String propertyName)
focal_class.identifier: getPropertyFromX500Principal
focal_class.modifiers: public static
focal_class.parameters: (X509Certificate cert, String propertyName)
focal_class.return: String
focal_class.signature: String getPropertyFromX500Principal(X509Certificate cert, String propertyName)
focal_class.class_method_signature: X509CertificateUtil.createPattern(String propertyName)
focal_class.full_signature: private static Pattern createPattern(String propertyName)
focal_class.identifier: createPattern
focal_class.modifiers: private static
focal_class.parameters: (String propertyName)
focal_class.return: Pattern
focal_class.signature: Pattern createPattern(String propertyName)
focal_class.class_method_signature: X509CertificateUtil.logAndThrowError(String errorMessage)
focal_class.full_signature: private static void logAndThrowError(String errorMessage)
focal_class.identifier: logAndThrowError
focal_class.modifiers: private static
focal_class.parameters: (String errorMessage)
focal_class.return: void
focal_class.signature: void logAndThrowError(String errorMessage)
focal_method.body: public static String getPropertyFromX500Principal(X509Certificate cert, String propertyName) { 
  		String propertyValue = null;
  		
  		String principalName = cert.getSubjectX500Principal().getName();
  		log.debug("Found principalName = {}", principalName);
  		
  		Pattern pattern = createPattern(propertyName);
  		Matcher matcher = pattern.matcher(principalName);
  		if (matcher.find()) {
  			propertyValue = matcher.group(1);
  			log.debug("Found principal property {} = {}", propertyName, propertyValue);
  		} else {
  			//FIXED: Replaced: "principalName" with "propertyName"
  			logAndThrowError("Principal property "  + propertyName + " not found in Certificate");
  		}
  		return propertyValue;
  	}
focal_method.class_method_signature: X509CertificateUtil.getPropertyFromX500Principal(X509Certificate cert, String propertyName)
focal_method.full_signature: public static String getPropertyFromX500Principal(X509Certificate cert, String propertyName)
focal_method.identifier: getPropertyFromX500Principal
focal_method.invocations: getName getSubjectX500Principal debug createPattern matcher find group debug logAndThrowError
focal_method.modifiers: public static
focal_method.parameters: (X509Certificate cert, String propertyName)
focal_method.return: String
focal_method.signature: String getPropertyFromX500Principal(X509Certificate cert, String propertyName)