Skip to content

Instantly share code, notes, and snippets.

@martinsson
Last active January 3, 2019 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinsson/786068e4ca243ffdc48be2a2a47eb99b to your computer and use it in GitHub Desktop.
Save martinsson/786068e4ca243ffdc48be2a2a47eb99b to your computer and use it in GitHub Desktop.
Using a instance method as a proxy to the real method we can fake it to avoid calling the real method
// this method is fakable
public String getTranslation(String key, Locale locale) {
return getTranslationOld(key, locale);
}
/**
* @deprecated use instance method instead
*/
public static String getTranslationOld(String key, Locale locale) {
Object keys = getTranslationMap().get(locale.toString());
// logic ...
// etc ...
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment