ValidConfigurationEnforcer extends AbstractJsonConfigurationHandler { public ValidationResult enforce() { return enforce(platform, tenant); } ValidConfigurationEnforcer(Map<String, Serializable> platform, Map<String, Serializable> tenant); ValidationResult enforce();  }
@Test public void testEnforceValidConfiguration() throws Exception { Map<String, Serializable> generalConfiguration = getConfiguration(defaultSettings); Map<String, Serializable> tenantConfiguration = loadConfiguration("configuration/tenant1.json"); ValidConfigurationEnforcer enforcer = new ValidConfigurationEnforcer(generalConfiguration, tenantConfiguration); ValidConfigurationEnforcer.ValidationResult result = enforcer.enforce(); Map<String, Serializable> enforced = result.getResult(); Assert.assertEquals(false, result.isHasErrors()); Assert.assertEquals(Locale.FRANCE.toString(), ((Map<String, Serializable>) enforced.get("locales")).get("main")); }
@Test public void testEnforceValidConfigurationWhenNotConfigurable() throws Exception { Map<String, Serializable> generalConfiguration = getConfiguration(localesNotConfigurablesSettings); Map<String, Serializable> tenantConfiguration = loadConfiguration("configuration/tenant1.json"); ValidConfigurationEnforcer enforcer = new ValidConfigurationEnforcer(generalConfiguration, tenantConfiguration); ValidConfigurationEnforcer.ValidationResult result = enforcer.enforce(); Map<String, Serializable> enforced = result.getResult(); Assert.assertEquals(true, result.isHasErrors()); Assert.assertTrue(((Map<String, Serializable>) enforced.get("locales")).isEmpty()); }