### Question:
LegacyLocalizationUtil { @SuppressWarnings("deprecation") public Properties exportLocalizedProperties(SchemaMeta schemaMeta, String locale) throws Exception { if(schemaMeta == null || locale == null) { if(schemaMeta == null) throw new IllegalArgumentException("Parameter \"schemaMeta\" MUST not be null"); if(locale == null) throw new IllegalArgumentException("Parameter \"locale\" MUST not be null"); } try{ Domain domain = ThinModelConverter.convertFromLegacy(schemaMeta); return localizationUtil.exportLocalizedProperties(domain, locale); } catch (Exception e) { if(logger.isDebugEnabled()) { logger.debug("Failed to export properties from legacy schema [" + schemaMeta.getName() + "]", e); } throw e; } } LegacyLocalizationUtil(); @SuppressWarnings("deprecation") Properties exportLocalizedProperties(SchemaMeta schemaMeta, String locale);  }### Answer:
@SuppressWarnings("deprecation") @Test public void testLegacyLocalization() throws Exception { SchemaMeta schemaMeta = loadLegacyMetadataModel("Steel Wheels", "src/test/resources/samples/steel-wheels.xmi"); LegacyLocalizationUtil localeUtil = new LegacyLocalizationUtil(); String locale = "en_US"; Properties props = localeUtil.exportLocalizedProperties(schemaMeta, locale); Assert.assertEquals(279, props.size()); Assert.assertEquals("Customer", props.get("[LogicalModel-BV_ORDERS].[Category-BC_CUSTOMER_W_TER_].[name]")); Assert.assertFalse("IPhysicalModel-null should not exist as such",props.containsKey("[IPhysicalModel-null].[PT_DEPARTMENT_MANAGERS].[MANAGER_NAME].[name]")); }
@Test public void testLegacyLocalizationNullSM() throws Exception { LegacyLocalizationUtil localeUtil = new LegacyLocalizationUtil(); String locale = "en_US"; Properties props = null; Exception ex = null; try { localeUtil.exportLocalizedProperties(null, locale); } catch(IllegalArgumentException e) { ex = e; } Assert.assertNotNull(ex); Assert.assertEquals(ex.getClass(), IllegalArgumentException.class); Assert.assertEquals("Parameter \"schemaMeta\" MUST not be null", ex.getMessage()); }
@Test public void testLegacyLocalizationNullLocale() throws Exception { SchemaMeta schemaMeta = loadLegacyMetadataModel("Steel Wheels", "src/test/resources/samples/steel-wheels.xmi"); LegacyLocalizationUtil localeUtil = new LegacyLocalizationUtil(); String locale = "en_US"; Properties props = null; Exception ex = null; try { localeUtil.exportLocalizedProperties(schemaMeta, null); } catch(IllegalArgumentException e) { ex = e; } Assert.assertNotNull(ex); Assert.assertEquals(ex.getClass(), IllegalArgumentException.class); Assert.assertEquals("Parameter \"locale\" MUST not be null", ex.getMessage()); }
@Test public void testLegacyLocalizationUnknownLocale() throws Exception { SchemaMeta schemaMeta = loadLegacyMetadataModel("Steel Wheels", "src/test/resources/samples/steel-wheels.xmi"); LegacyLocalizationUtil localeUtil = new LegacyLocalizationUtil(); String locale = "abc_XYZ"; Properties props = localeUtil.exportLocalizedProperties(schemaMeta, locale); Assert.assertEquals(279, props.size()); Assert.assertEquals("Customer", props.get("[LogicalModel-BV_ORDERS].[Category-BC_CUSTOMER_W_TER_].[name]")); }