-
Notifications
You must be signed in to change notification settings - Fork 680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#1064 add default value for static fields to make it easier to write … #1065
#1064 add default value for static fields to make it easier to write … #1065
Conversation
…ier to write pure unit tests: * Play.configuration * Play.id * Play.javaPath * Play.applicationPath * Play.mode * Play.templatesPath * Play.modulesRoutes * Messages.defaults
@@ -107,7 +107,7 @@ public static String getMessage(String locale, Object key, Object... args) { | |||
if (value == null && locale != null && locale.length() == 5 && locales.containsKey(locale.substring(0, 2))) { | |||
value = locales.get(locale.substring(0, 2)).getProperty(key.toString()); | |||
} | |||
if (value == null && defaults != null) { | |||
if (value == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should keep the test default != null
as defaults
is public it can be set to null outside the class
@@ -196,7 +196,7 @@ public static Properties all(String locale) { | |||
return defaults; | |||
Properties mergedMessages = new Properties(); | |||
mergedMessages.putAll(defaults); | |||
if (locale != null && locale.length() == 5 && locales.containsKey(locale.substring(0, 2))) { | |||
if (locale.length() == 5 && locales.containsKey(locale.substring(0, 2))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should keep the test locale != null
as locale is public it can be set to null outside the class
@@ -196,7 +196,7 @@ public static Properties all(String locale) { | |||
return defaults; | |||
Properties mergedMessages = new Properties(); | |||
mergedMessages.putAll(defaults); | |||
if (locale != null && locale.length() == 5 && locales.containsKey(locale.substring(0, 2))) { | |||
if (locale.length() == 5 && locales.containsKey(locale.substring(0, 2))) { | |||
mergedMessages.putAll(locales.get(locale.substring(0, 2))); | |||
} | |||
mergedMessages.putAll(locales.get(locale)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should as test on locale
before using it
it's not needed anymore in Play 1.4.x because of playframework/play1#1065
it's not needed anymore in Play 1.4.x because of playframework/play1#1065
it's not needed anymore in Play 1.4.x because of playframework/play1#1065
…pure unit tests:
(PR for issue #1064)