Example usage for java.security GeneralSecurityException GeneralSecurityException

List of usage examples for java.security GeneralSecurityException GeneralSecurityException

Introduction

In this page you can find the example usage for java.security GeneralSecurityException GeneralSecurityException.

Prototype

public GeneralSecurityException() 

Source Link

Document

Constructs a GeneralSecurityException with no detail message.

Usage

From source file:com.google.api.server.spi.auth.GoogleJwtAuthenticatorTest.java

@Test
public void testVerifyToken() throws Exception {
    when(verifier.verify(TOKEN)).thenReturn(token).thenThrow(new GeneralSecurityException())
            .thenThrow(new IOException()).thenThrow(new IllegalArgumentException());
    assertEquals(token, authenticator.verifyToken(TOKEN));
    for (int i = 0; i < 3; i++) {
        assertNull(authenticator.verifyToken(TOKEN));
    }/*from  w w w.  j  a v  a  2  s. c o  m*/
}

From source file:org.trustedanalytics.user.secure.serializer.SecureJsonSerializerTest.java

@Test
public void testJsonDeseralization_SecurityException_exceptionThrown() throws EncryptionException {
    thrown.expect(SerializationException.class);
    thrown.expectMessage("Could not decrypt Secure-JSON");
    when(encryptionService.decrypt(any()))
            .thenThrow(new EncryptionException("a", new GeneralSecurityException()));

    SecurityCode sut = secureJsonRedisSerializer.deserialize(SERIALIZED_JSON.getBytes());
}

From source file:org.trustedanalytics.user.secure.serializer.SecureJsonSerializerTest.java

@Test
public void testJsonSeralization_SecurityException_exceptionThrown() throws EncryptionException {
    thrown.expect(SerializationException.class);
    thrown.expectMessage("Could not encrypt Secure-JSON");
    when(encryptionService.encrypt(any()))
            .thenThrow(new EncryptionException("a", new GeneralSecurityException()));

    byte[] sut = secureJsonRedisSerializer.serialize(SECURITY_CODE);
}