@Test public void settingInvalidArgumentToConfiguredEnvironment(){ try { env2.setConfiguredEnvironment("dev"); fail("Should be thrown an Illegal argument exception!"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), CoreMatchers.containsString("Check your config file!")); } }
void setConfiguredEnvironment(String configuredEnvironment){ try { this.environment = configuredEnvironment!=null ? Environment.valueOf(configuredEnvironment) : Environment.development; } catch (IllegalArgumentException e){ throw new IllegalArgumentException(configuredEnvironment + " is not a valid env. Check your config file!", e); } validateEnvironmentAgainstIps(); }
Env { void setConfiguredEnvironment(String configuredEnvironment){ try { this.environment = configuredEnvironment!=null ? Environment.valueOf(configuredEnvironment) : Environment.development; } catch (IllegalArgumentException e){ throw new IllegalArgumentException(configuredEnvironment + " is not a valid env. Check your config file!", e); } validateEnvironmentAgainstIps(); } }
Env { void setConfiguredEnvironment(String configuredEnvironment){ try { this.environment = configuredEnvironment!=null ? Environment.valueOf(configuredEnvironment) : Environment.development; } catch (IllegalArgumentException e){ throw new IllegalArgumentException(configuredEnvironment + " is not a valid env. Check your config file!", e); } validateEnvironmentAgainstIps(); } Env();  Env(String[] productionIps, String[] stagingIps, String[] testingIps);  Env(List<String> ipProduction, List<String> ipStaging, List<String> ipTesting); }
Env { void setConfiguredEnvironment(String configuredEnvironment){ try { this.environment = configuredEnvironment!=null ? Environment.valueOf(configuredEnvironment) : Environment.development; } catch (IllegalArgumentException e){ throw new IllegalArgumentException(configuredEnvironment + " is not a valid env. Check your config file!", e); } validateEnvironmentAgainstIps(); } Env();  Env(String[] productionIps, String[] stagingIps, String[] testingIps);  Env(List<String> ipProduction, List<String> ipStaging, List<String> ipTesting); boolean isProduction(final String address); boolean isStaging(final String address); boolean isTesting(final String address); boolean isDevelopment(final String address); String getProductionIps(); String getStagingIps(); String getTestingIps(); @Override String toString(); }
Env { void setConfiguredEnvironment(String configuredEnvironment){ try { this.environment = configuredEnvironment!=null ? Environment.valueOf(configuredEnvironment) : Environment.development; } catch (IllegalArgumentException e){ throw new IllegalArgumentException(configuredEnvironment + " is not a valid env. Check your config file!", e); } validateEnvironmentAgainstIps(); } Env();  Env(String[] productionIps, String[] stagingIps, String[] testingIps);  Env(List<String> ipProduction, List<String> ipStaging, List<String> ipTesting); boolean isProduction(final String address); boolean isStaging(final String address); boolean isTesting(final String address); boolean isDevelopment(final String address); String getProductionIps(); String getStagingIps(); String getTestingIps(); @Override String toString();  }