	@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());
		}
	}