List of usage examples for org.springframework.context MessageSource MessageSource
MessageSource
From source file:cherry.foundation.type.EnumUtilTest.java
private MessageSource createMessageSource() { final Map<String, String> map = new HashMap<>(); map.put("cherry.foundation.type.FlagCode.FALSE", "FLAG_CODE_FALSE"); map.put("cherry.foundation.type.FlagCode.TRUE", "FLAG_CODE_TRUE"); return new MessageSource() { @Override//from w w w . j a va 2 s . c om public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) { return null; } @Override public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException { return map.get(code); } @Override public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException { return null; } }; }
From source file:cherry.foundation.type.EnumCodeUtilTest.java
private MessageSource createMessageSource() { final Map<String, String> map = new HashMap<>(); map.put("cherry.foundation.type.FlagCode.0", "FLAG_CODE_FALSE"); map.put("cherry.foundation.type.FlagCode.1", "FLAG_CODE_TRUE"); return new MessageSource() { @Override/*from w ww .j a v a 2s. co m*/ public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) { return null; } @Override public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException { return map.get(code); } @Override public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException { return null; } }; }
From source file:edu.duke.cabig.c3pr.webservice.helpers.SubjectRegistryRelatedTestCase.java
/** * @return/* w w w. ja va 2 s . c o m*/ */ protected MessageSource getMessageSourceMock() { return new MessageSource() { public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) { // TODO Auto-generated method stub return ""; } public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException { // TODO Auto-generated method stub return ""; } public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException { // TODO Auto-generated method stub return ""; } }; }