How to verify X509 cert without importing root cert?

I opened an Issue on dotnet/corefx and they replied as follows: If AllowUnknownCertificateAuthority is the only flag set then chain.Build() will return true if The chain correctly terminated in a self-signed certificate (via ExtraStore, or searched persisted stores) None of the certificates are invalid per the requested revocation policy All of the certificates are valid … Read more

Verify email in Java

Here is what I have around. To check that the address is a valid format, here is a regex that verifies that it’s nearly rfc2822 (it doesn’t catch some weird corner cases). I found it on the ‘net last year. private static final Pattern rfc2822 = Pattern.compile( “^[a-z0-9!#$%&’*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&’*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$” ); if (!rfc2822.matcher(email).matches()) { throw new Exception(“Invalid … Read more

Java verify void method calls n times with Mockito

The necessary method is Mockito#verify: public static <T> T verify(T mock, VerificationMode mode) mock is your mocked object and mode is the VerificationMode that describes how the mock should be verified. Possible modes are: verify(mock, times(5)).someMethod(“was called five times”); verify(mock, never()).someMethod(“was never called”); verify(mock, atLeastOnce()).someMethod(“was called at least once”); verify(mock, atLeast(2)).someMethod(“was called at least twice”); … Read more

How to continue execution when Assertion is failed

I suggest you to use soft assertions, which are provided in TestNg natively package automation.tests; import org.testng.asserts.Assertion; import org.testng.asserts.SoftAssert; public class MyTest { private Assertion hardAssert = new Assertion(); private SoftAssert softAssert = new SoftAssert(); } @Test public void testForSoftAssertionFailure() { softAssert.assertTrue(false); softAssert.assertEquals(1, 2); softAssert.assertAll(); } Source: http://rameshbaskar.wordpress.com/2013/09/11/soft-assertions-using-testng/