aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-testing-harness/src/test
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2011-09-29 18:05:09 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2011-09-29 18:05:09 +0200
commit3d4da0c8c9d101a02feec363b2b09e3faa69a10a (patch)
tree1b6558cfa30b518542abc67efd87042598013590 /sonar-testing-harness/src/test
parent671905d1ae89fd3c0b547caab28d82b28042fc58 (diff)
downloadsonarqube-3d4da0c8c9d101a02feec363b2b09e3faa69a10a.tar.gz
sonarqube-3d4da0c8c9d101a02feec363b2b09e3faa69a10a.zip
SONAR-2846 API: the i18n Hamcrest matcher should not fail if some keys are not defined in the reference bundle
Diffstat (limited to 'sonar-testing-harness/src/test')
-rw-r--r--sonar-testing-harness/src/test/java/org/sonar/test/i18n/BundleSynchronizedTest.java29
-rw-r--r--sonar-testing-harness/src/test/resources/org/sonar/l10n/noMissingKeys.properties1
-rw-r--r--sonar-testing-harness/src/test/resources/org/sonar/l10n/noMissingKeys_fr.properties2
3 files changed, 14 insertions, 18 deletions
diff --git a/sonar-testing-harness/src/test/java/org/sonar/test/i18n/BundleSynchronizedTest.java b/sonar-testing-harness/src/test/java/org/sonar/test/i18n/BundleSynchronizedTest.java
index 6568ff16101..914184911fa 100644
--- a/sonar-testing-harness/src/test/java/org/sonar/test/i18n/BundleSynchronizedTest.java
+++ b/sonar-testing-harness/src/test/java/org/sonar/test/i18n/BundleSynchronizedTest.java
@@ -19,21 +19,16 @@
*/
package org.sonar.test.i18n;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.hasItem;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.sonar.test.i18n.I18nMatchers.isBundleUpToDate;
+import org.junit.Before;
+import org.junit.Test;
+import org.sonar.test.TestUtils;
import java.io.File;
-import java.util.Collection;
import java.util.SortedMap;
-import org.junit.Before;
-import org.junit.Test;
-import org.sonar.test.TestUtils;
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
+import static org.sonar.test.i18n.I18nMatchers.isBundleUpToDate;
public class BundleSynchronizedTest {
@@ -58,13 +53,11 @@ public class BundleSynchronizedTest {
} catch (AssertionError e) {
assertThat(e.getMessage(), containsString("Missing translations are:\nsecond.prop"));
}
- // unnecessary many keys
- try {
- assertThat("myPlugin_fr_QB.properties", isBundleUpToDate());
- assertTrue(new File("target/l10n/myPlugin_fr_QB.properties.report.txt").exists());
- } catch (AssertionError e) {
- assertThat(e.getMessage(), containsString("The following translations do not exist in the reference bundle:\nfourth.prop"));
- }
+ }
+
+ @Test
+ public void shouldNotFailIfNoMissingKeysButAdditionalKeys() {
+ assertThat("noMissingKeys_fr.properties", isBundleUpToDate());
}
@Test
diff --git a/sonar-testing-harness/src/test/resources/org/sonar/l10n/noMissingKeys.properties b/sonar-testing-harness/src/test/resources/org/sonar/l10n/noMissingKeys.properties
new file mode 100644
index 00000000000..3fb9281f6a7
--- /dev/null
+++ b/sonar-testing-harness/src/test/resources/org/sonar/l10n/noMissingKeys.properties
@@ -0,0 +1 @@
+foo=Foo \ No newline at end of file
diff --git a/sonar-testing-harness/src/test/resources/org/sonar/l10n/noMissingKeys_fr.properties b/sonar-testing-harness/src/test/resources/org/sonar/l10n/noMissingKeys_fr.properties
new file mode 100644
index 00000000000..9df3201b51f
--- /dev/null
+++ b/sonar-testing-harness/src/test/resources/org/sonar/l10n/noMissingKeys_fr.properties
@@ -0,0 +1,2 @@
+foo=Hein
+not_in_reference=Not in reference \ No newline at end of file