From: Juergen H. <jho...@us...> - 2006-04-21 00:13:56
|
Update of /cvsroot/springframework/spring/test/org/springframework/context/support In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/test/org/springframework/context/support Modified Files: Tag: mbranch-1-2 StaticMessageSourceTests.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: StaticMessageSourceTests.java =================================================================== RCS file: /cvsroot/springframework/spring/test/org/springframework/context/support/StaticMessageSourceTests.java,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -C2 -d -r1.4 -r1.4.4.1 *** StaticMessageSourceTests.java 6 Apr 2005 21:31:58 -0000 1.4 --- StaticMessageSourceTests.java 21 Apr 2006 00:13:51 -0000 1.4.4.1 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,11 ---- /* ! * Copyright 2002-2006 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 229,231 **** --- 229,259 ---- } + public void testNestedMessageSourceWithParamInChild() { + StaticMessageSource source = new StaticMessageSource(); + StaticMessageSource parent = new StaticMessageSource(); + source.setParentMessageSource(parent); + + source.addMessage("param", Locale.ENGLISH, "value"); + parent.addMessage("with.param", Locale.ENGLISH, "put {0} here"); + + MessageSourceResolvable resolvable = new DefaultMessageSourceResolvable( + new String[] {"with.param"}, new Object[] {new DefaultMessageSourceResolvable("param")}); + + assertEquals("put value here", source.getMessage(resolvable, Locale.ENGLISH)); + } + + public void testNestedMessageSourceWithParamInParent() { + StaticMessageSource source = new StaticMessageSource(); + StaticMessageSource parent = new StaticMessageSource(); + source.setParentMessageSource(parent); + + parent.addMessage("param", Locale.ENGLISH, "value"); + source.addMessage("with.param", Locale.ENGLISH, "put {0} here"); + + MessageSourceResolvable resolvable = new DefaultMessageSourceResolvable( + new String[] {"with.param"}, new Object[] {new DefaultMessageSourceResolvable("param")}); + + assertEquals("put value here", source.getMessage(resolvable, Locale.ENGLISH)); + } + } |