@Test(expected = PagSeguroLibException.class) public void shouldThrowException() throws Exception { when(jvmEnvVariableEnvironmentProvider.getEnvironment()) .thenThrow(new IllegalArgumentException()); when(systemPropEnvironmentProvider.getEnvironment()).thenThrow(new IllegalArgumentException()); when(systemEnvVariableEnvironmentProvider.getEnvironment()) .thenThrow(new IllegalArgumentException()); providerChain.getEnvironment(); }
public PagSeguroEnv getEnvironment() { LOGGER.info("Iniciando leitura das configuracoes de ambiente"); for (EnvironmentProvider environmentProvider : environmentProviders) { try { return environmentProvider.getEnvironment(); } catch (Exception e) { } } throw new PagSeguroLibException(new RuntimeException("Can not create PagSeguro Environment " + "from providers")); }
DefaultEnvironmentProviderChain { public PagSeguroEnv getEnvironment() { LOGGER.info("Iniciando leitura das configuracoes de ambiente"); for (EnvironmentProvider environmentProvider : environmentProviders) { try { return environmentProvider.getEnvironment(); } catch (Exception e) { } } throw new PagSeguroLibException(new RuntimeException("Can not create PagSeguro Environment " + "from providers")); } }
DefaultEnvironmentProviderChain { public PagSeguroEnv getEnvironment() { LOGGER.info("Iniciando leitura das configuracoes de ambiente"); for (EnvironmentProvider environmentProvider : environmentProviders) { try { return environmentProvider.getEnvironment(); } catch (Exception e) { } } throw new PagSeguroLibException(new RuntimeException("Can not create PagSeguro Environment " + "from providers")); } DefaultEnvironmentProviderChain(); }
DefaultEnvironmentProviderChain { public PagSeguroEnv getEnvironment() { LOGGER.info("Iniciando leitura das configuracoes de ambiente"); for (EnvironmentProvider environmentProvider : environmentProviders) { try { return environmentProvider.getEnvironment(); } catch (Exception e) { } } throw new PagSeguroLibException(new RuntimeException("Can not create PagSeguro Environment " + "from providers")); } DefaultEnvironmentProviderChain(); PagSeguroEnv getEnvironment(); }
DefaultEnvironmentProviderChain { public PagSeguroEnv getEnvironment() { LOGGER.info("Iniciando leitura das configuracoes de ambiente"); for (EnvironmentProvider environmentProvider : environmentProviders) { try { return environmentProvider.getEnvironment(); } catch (Exception e) { } } throw new PagSeguroLibException(new RuntimeException("Can not create PagSeguro Environment " + "from providers")); } DefaultEnvironmentProviderChain(); PagSeguroEnv getEnvironment();  }