@Test public void shouldGetSandboxEnv() throws Exception { provider = new SystemPropEnvironmentProvider("pagseguro.properties"); PagSeguroEnv expectedEnv = PagSeguroEnv.SANDBOX; PagSeguroEnv env = provider.getEnvironment(); assertEquals(expectedEnv, env); }
@Override public PagSeguroEnv getEnvironment() throws Exception { LOGGER.info("Lendo configuracoes de ambiente"); final PagSeguroEnv environment; InputStream inputStream = getClass().getClassLoader().getResourceAsStream(file); Properties properties = new Properties(); properties.load(inputStream); if (properties.getProperty("environment") != null) { environment = PagSeguroEnv.fromName(properties.getProperty("environment")); } else { throw new IllegalArgumentException("Environment property not found"); } LOGGER.info("Configuracoes de ambiente lidas"); return environment; }
SystemPropEnvironmentProvider implements EnvironmentProvider { @Override public PagSeguroEnv getEnvironment() throws Exception { LOGGER.info("Lendo configuracoes de ambiente"); final PagSeguroEnv environment; InputStream inputStream = getClass().getClassLoader().getResourceAsStream(file); Properties properties = new Properties(); properties.load(inputStream); if (properties.getProperty("environment") != null) { environment = PagSeguroEnv.fromName(properties.getProperty("environment")); } else { throw new IllegalArgumentException("Environment property not found"); } LOGGER.info("Configuracoes de ambiente lidas"); return environment; } }
SystemPropEnvironmentProvider implements EnvironmentProvider { @Override public PagSeguroEnv getEnvironment() throws Exception { LOGGER.info("Lendo configuracoes de ambiente"); final PagSeguroEnv environment; InputStream inputStream = getClass().getClassLoader().getResourceAsStream(file); Properties properties = new Properties(); properties.load(inputStream); if (properties.getProperty("environment") != null) { environment = PagSeguroEnv.fromName(properties.getProperty("environment")); } else { throw new IllegalArgumentException("Environment property not found"); } LOGGER.info("Configuracoes de ambiente lidas"); return environment; } SystemPropEnvironmentProvider(String file); }
SystemPropEnvironmentProvider implements EnvironmentProvider { @Override public PagSeguroEnv getEnvironment() throws Exception { LOGGER.info("Lendo configuracoes de ambiente"); final PagSeguroEnv environment; InputStream inputStream = getClass().getClassLoader().getResourceAsStream(file); Properties properties = new Properties(); properties.load(inputStream); if (properties.getProperty("environment") != null) { environment = PagSeguroEnv.fromName(properties.getProperty("environment")); } else { throw new IllegalArgumentException("Environment property not found"); } LOGGER.info("Configuracoes de ambiente lidas"); return environment; } SystemPropEnvironmentProvider(String file); @Override PagSeguroEnv getEnvironment(); }
SystemPropEnvironmentProvider implements EnvironmentProvider { @Override public PagSeguroEnv getEnvironment() throws Exception { LOGGER.info("Lendo configuracoes de ambiente"); final PagSeguroEnv environment; InputStream inputStream = getClass().getClassLoader().getResourceAsStream(file); Properties properties = new Properties(); properties.load(inputStream); if (properties.getProperty("environment") != null) { environment = PagSeguroEnv.fromName(properties.getProperty("environment")); } else { throw new IllegalArgumentException("Environment property not found"); } LOGGER.info("Configuracoes de ambiente lidas"); return environment; } SystemPropEnvironmentProvider(String file); @Override PagSeguroEnv getEnvironment();  }