class JavaPropertyScanner extends AbstractPropertyScanner implements PropertyScanner {

    @Override
    public Locale getLocale(File propertyFile) {
        Matcher matcher = LOCALE_PATTERN.matcher(propertyFile.getName());
        if (matcher.matches()) {
            String actualLocale = matcher.group(2);
            if(actualLocale==null || actualLocale.isEmpty())
                return null;
            actualLocale = actualLocale.substring(1);
            return (Locale) PropertiesFactory.eINSTANCE.createFromString(PropertiesPackage.Literals.LOCALE, actualLocale);
        }
        return null;
    }

}

class JavaPropertyScannerTest {

	private JavaPropertyScanner fixture;

	@Test
	public void testGetLocale() {

		assertEquals(new Locale("de","DE"),getFixture().getLocale(new File("test_de_DE.properties")));
		assertEquals(new Locale("de","DE"),getFixture().getLocale(new File("tes_en_USt_de_DE.properties")));
	}

}