@Test public void testGetLocalizationWithParameters() { assertTrue("param 1 param 2".equals(localization.getMessage("key3", "default message", 1, 2))); }
@Override public String getMessage(String key, String defaultMessage, Object... parameters) { if (null == resourceBundle) { return defaultMessage; } String message; try { message = resourceBundle.getString(key); } catch (MissingResourceException e) { message = defaultMessage; } if (parameters.length > 0) { message = String.format(message, parameters); } return message; }
PropertyFileLocalization extends AbstractLocalization { @Override public String getMessage(String key, String defaultMessage, Object... parameters) { if (null == resourceBundle) { return defaultMessage; } String message; try { message = resourceBundle.getString(key); } catch (MissingResourceException e) { message = defaultMessage; } if (parameters.length > 0) { message = String.format(message, parameters); } return message; } }
PropertyFileLocalization extends AbstractLocalization { @Override public String getMessage(String key, String defaultMessage, Object... parameters) { if (null == resourceBundle) { return defaultMessage; } String message; try { message = resourceBundle.getString(key); } catch (MissingResourceException e) { message = defaultMessage; } if (parameters.length > 0) { message = String.format(message, parameters); } return message; } PropertyFileLocalization(String bundleName, Locale locale); }
PropertyFileLocalization extends AbstractLocalization { @Override public String getMessage(String key, String defaultMessage, Object... parameters) { if (null == resourceBundle) { return defaultMessage; } String message; try { message = resourceBundle.getString(key); } catch (MissingResourceException e) { message = defaultMessage; } if (parameters.length > 0) { message = String.format(message, parameters); } return message; } PropertyFileLocalization(String bundleName, Locale locale); @Override String getMessage(String key, String defaultMessage, Object... parameters); @Override Locale getLocale(); }
PropertyFileLocalization extends AbstractLocalization { @Override public String getMessage(String key, String defaultMessage, Object... parameters) { if (null == resourceBundle) { return defaultMessage; } String message; try { message = resourceBundle.getString(key); } catch (MissingResourceException e) { message = defaultMessage; } if (parameters.length > 0) { message = String.format(message, parameters); } return message; } PropertyFileLocalization(String bundleName, Locale locale); @Override String getMessage(String key, String defaultMessage, Object... parameters); @Override Locale getLocale();  }