@Test(expected = PagSeguroLibException.class) public void shouldThrowException() throws Exception { when(jvmEnvVariableCredentialProvider.getCredential()) .thenThrow(new IllegalArgumentException()); when(systemPropCredentialProvider.getCredential()).thenThrow(new IllegalArgumentException()); when(systemEnvVariableCredentialProvider.getCredential()) .thenThrow(new IllegalArgumentException()); providerChain.getCredential(); }
public Credential getCredential() { LOGGER.info("Iniciando leitura das credenciais"); for (CredentialProvider credentialProvider : credentialProviders) { try { return credentialProvider.getCredential(); } catch (Exception e) { } } throw new PagSeguroLibException(new RuntimeException("Can not create Credentials " + "from providers")); }
DefaultCredentialProviderChain { public Credential getCredential() { LOGGER.info("Iniciando leitura das credenciais"); for (CredentialProvider credentialProvider : credentialProviders) { try { return credentialProvider.getCredential(); } catch (Exception e) { } } throw new PagSeguroLibException(new RuntimeException("Can not create Credentials " + "from providers")); } }
DefaultCredentialProviderChain { public Credential getCredential() { LOGGER.info("Iniciando leitura das credenciais"); for (CredentialProvider credentialProvider : credentialProviders) { try { return credentialProvider.getCredential(); } catch (Exception e) { } } throw new PagSeguroLibException(new RuntimeException("Can not create Credentials " + "from providers")); } DefaultCredentialProviderChain(); }
DefaultCredentialProviderChain { public Credential getCredential() { LOGGER.info("Iniciando leitura das credenciais"); for (CredentialProvider credentialProvider : credentialProviders) { try { return credentialProvider.getCredential(); } catch (Exception e) { } } throw new PagSeguroLibException(new RuntimeException("Can not create Credentials " + "from providers")); } DefaultCredentialProviderChain(); Credential getCredential(); }
DefaultCredentialProviderChain { public Credential getCredential() { LOGGER.info("Iniciando leitura das credenciais"); for (CredentialProvider credentialProvider : credentialProviders) { try { return credentialProvider.getCredential(); } catch (Exception e) { } } throw new PagSeguroLibException(new RuntimeException("Can not create Credentials " + "from providers")); } DefaultCredentialProviderChain(); Credential getCredential();  }