@Test public void shouldGetProductionEnv() throws Exception { when(System.getenv("PSL_ENVIRONMENT")).thenReturn("production"); PagSeguroEnv expectedEnv = PagSeguroEnv.PRODUCTION; PagSeguroEnv env = provider.getEnvironment(); assertEquals(expectedEnv, env); }
@Override public PagSeguroEnv getEnvironment() throws Exception { LOGGER.info("Lendo configuracoes de ambiente"); final PagSeguroEnv environment; if (System.getenv("PSL_ENVIRONMENT") != null) { environment = PagSeguroEnv.fromName(System.getenv("PSL_ENVIRONMENT")); } else { throw new IllegalArgumentException("Environment property not found"); } LOGGER.info("Configuracoes de ambiente lidas"); return environment; }
SystemEnvVariableEnvironmentProvider implements EnvironmentProvider { @Override public PagSeguroEnv getEnvironment() throws Exception { LOGGER.info("Lendo configuracoes de ambiente"); final PagSeguroEnv environment; if (System.getenv("PSL_ENVIRONMENT") != null) { environment = PagSeguroEnv.fromName(System.getenv("PSL_ENVIRONMENT")); } else { throw new IllegalArgumentException("Environment property not found"); } LOGGER.info("Configuracoes de ambiente lidas"); return environment; } }
SystemEnvVariableEnvironmentProvider implements EnvironmentProvider { @Override public PagSeguroEnv getEnvironment() throws Exception { LOGGER.info("Lendo configuracoes de ambiente"); final PagSeguroEnv environment; if (System.getenv("PSL_ENVIRONMENT") != null) { environment = PagSeguroEnv.fromName(System.getenv("PSL_ENVIRONMENT")); } else { throw new IllegalArgumentException("Environment property not found"); } LOGGER.info("Configuracoes de ambiente lidas"); return environment; } SystemEnvVariableEnvironmentProvider(); }
SystemEnvVariableEnvironmentProvider implements EnvironmentProvider { @Override public PagSeguroEnv getEnvironment() throws Exception { LOGGER.info("Lendo configuracoes de ambiente"); final PagSeguroEnv environment; if (System.getenv("PSL_ENVIRONMENT") != null) { environment = PagSeguroEnv.fromName(System.getenv("PSL_ENVIRONMENT")); } else { throw new IllegalArgumentException("Environment property not found"); } LOGGER.info("Configuracoes de ambiente lidas"); return environment; } SystemEnvVariableEnvironmentProvider(); @Override PagSeguroEnv getEnvironment(); }
SystemEnvVariableEnvironmentProvider implements EnvironmentProvider { @Override public PagSeguroEnv getEnvironment() throws Exception { LOGGER.info("Lendo configuracoes de ambiente"); final PagSeguroEnv environment; if (System.getenv("PSL_ENVIRONMENT") != null) { environment = PagSeguroEnv.fromName(System.getenv("PSL_ENVIRONMENT")); } else { throw new IllegalArgumentException("Environment property not found"); } LOGGER.info("Configuracoes de ambiente lidas"); return environment; } SystemEnvVariableEnvironmentProvider(); @Override PagSeguroEnv getEnvironment();  }