Minor fix in FlowPartialViewContext

The fix ensures that getRenderIds returns a mutable collection as
stated in the contract for the method in PartialViewContext.

Issues: SWF-1480
This commit is contained in:
Rossen Stoyanchev
2012-02-29 12:21:07 -05:00
parent 3430771c30
commit 63151acb8d
2 changed files with 18 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ import org.springframework.webflow.test.MockRequestContext;
public class FlowPartialViewContextTests extends TestCase {
@SuppressWarnings("unchecked")
public void testReturnFragmentIds() throws Exception {
String[] fragmentIds = new String[] { "foo", "bar" };
@@ -46,4 +47,18 @@ public class FlowPartialViewContextTests extends TestCase {
assertEquals(renderIds, context.getRenderIds());
}
@SuppressWarnings("unchecked")
public void testReturnFragmentIdsMutable() throws Exception {
String[] fragmentIds = new String[] { "foo", "bar" };
RequestContext requestContext = new MockRequestContext();
requestContext.getFlashScope().asMap().put(View.RENDER_FRAGMENTS_ATTRIBUTE, fragmentIds);
RequestContextHolder.setRequestContext(requestContext);
Collection<String> renderIds = new FlowPartialViewContext(null).getRenderIds();
renderIds.add("baz");
assertEquals(Arrays.asList("foo", "bar", "baz"), renderIds);
}
}