@Test
public void testCreateEnvironmentKeyPair() throws Exception
{

    KeyPair keyPair = mock( KeyPair.class );
    doReturn( keyPair ).when( keyManager ).generateKeyPair( TestHelper.ENV_ID, false );
    PGPSecretKeyRing secRing = mock( PGPSecretKeyRing.class );
    PGPPublicKeyRing pubRing = mock( PGPPublicKeyRing.class );
    doReturn( secRing ).when( pgpKeyUtil ).getSecretKeyRing( any( byte[].class ) );
    doReturn( pubRing ).when( pgpKeyUtil ).getPublicKeyRing( any( byte[].class ) );
    environmentManager.createEnvironmentKeyPair( TestHelper.ENVIRONMENT_ID );
    verify( keyManager ).saveSecretKeyRing( TestHelper.ENV_ID, SecurityKeyType.ENVIRONMENT_KEY.getId(), secRing );
    verify( keyManager ).savePublicKeyRing( TestHelper.ENV_ID, SecurityKeyType.ENVIRONMENT_KEY.getId(), pubRing );
}