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:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user