// and now let's compare!
try {
+ // search for missing keys
missingKeys = retrieveMissingTranslations(bundleInputStream, defaultBundleInputStream);
+
+ // and now for additional keys
+ bundleInputStream = getBundleFileInputStream(bundleName);
+ defaultBundleInputStream = getDefaultBundleFileInputStream(bundleName);
additionalKeys = retrieveMissingTranslations(defaultBundleInputStream, bundleInputStream);
+
+ // And fail only if there are missing keys
return missingKeys.isEmpty();
} catch (IOException e) {
fail("An error occured while reading the bundles: " + e.getMessage());
assertFalse(new File("target/l10n/myPlugin_fr_CA.properties.report.txt").exists());
}
+ @Test
+ public void shouldMatchEvenWithAdditionalKeys() {
+ assertThat("myPlugin_fr_QB.properties", matcher);
+ assertFalse(new File("target/l10n/myPlugin_fr_CA.properties.report.txt").exists());
+ }
+
@Test
public void shouldNotMatch() {
try {
assertTrue(new File("target/l10n/myPlugin_fr.properties.report.txt").exists());
} catch (AssertionError e) {
assertThat(e.getMessage(), containsString("Missing translations are:\nsecond.prop"));
+ assertThat(e.getMessage(), containsString("The following translations do not exist in the reference bundle:\nfourth.prop"));
}
}
## -------- Test file for the BundleSynchronizedMatcher -------- ##
first.prop = C'est ma première propriété
#second.prop = C'est ma deuxième propriété
-third.prop = C'est ma troisième propriété
\ No newline at end of file
+third.prop = C'est ma troisième propriété
+fourth.prop = C'est ma quatrième propriété
\ No newline at end of file