@@ -116,6 +116,24 @@ public void keyValueShouldBeEqualForEnglishPropertiesMessages() {
116
116
}
117
117
}
118
118
119
+ @ Test
120
+ public void languageKeysShouldNotBeQuotedInFiles () throws IOException {
121
+ final List <LocalizationEntry > quotedEntries = LocalizationParser
122
+ .findLocalizationParametersStringsInJavaFiles (LocalizationBundleForTest .LANG )
123
+ .stream ()
124
+ .filter (key -> key .getKey ().contains ("_" ) && key .getKey ().equals (new LocalizationKey (key .getKey ()).getPropertiesKey ()))
125
+ .collect (Collectors .toList ());
126
+ Assert .assertEquals (
127
+ "Language keys must not be used quoted in code! Use \" This is a message\" instead of \" This_is_a_message\" .\n " +
128
+ "Please correct the following entries:\n " +
129
+ quotedEntries
130
+ .stream ()
131
+ .map (key -> String .format ("\n %s (%s)\n " , key .getKey (), key .getPath ()))
132
+ .collect (Collectors .toList ())
133
+ ,
134
+ Collections .EMPTY_LIST , quotedEntries );
135
+ }
136
+
119
137
@ Test
120
138
public void findMissingLocalizationKeys () throws IOException {
121
139
List <LocalizationEntry > missingKeys = LocalizationParser .find (LocalizationBundleForTest .LANG ).stream ().sorted ()
@@ -125,7 +143,7 @@ public void findMissingLocalizationKeys() throws IOException {
125
143
"1. PASTE THESE INTO THE ENGLISH LANGUAGE FILE\n " +
126
144
"2. EXECUTE: gradlew localizationUpdate\n " +
127
145
missingKeys .parallelStream ()
128
- .map (key -> String .format ("%s=%s" , key .getKey (), key .getKey ()))
146
+ .map (key -> String .format ("\n %s=%s\n " , key .getKey (), key .getKey ()))
129
147
.collect (Collectors .toList ()),
130
148
Collections .<LocalizationEntry >emptyList (), missingKeys );
131
149
}
0 commit comments