assertThat((String) model.asMap().get(ModelKeys.REFERRING_PAGE_ID), is(equalTo(REFERRER_ID)));
}
@Test
public void testUpdatePreferences_valid() {
ModelMap model = new ExtendedModelMap();
PortalPreferenceForm form = new PortalPreferenceForm(new HashMap<String, PortalPreference>());
final BindingResult errors = new BeanPropertyBindingResult(form, "form");
SessionStatus sessionStatus = createMock(SessionStatus.class);
final Set<Map.Entry<String, PortalPreference>> entries = form.getPreferenceMap().entrySet();
for (Map.Entry<String, PortalPreference> entry : entries) {
service.savePreference(entry.getValue());
}
sessionStatus.setComplete();
expectLastCall();
replay(service, sessionStatus);
String view = controller.updatePreferences(form, errors, validToken, validToken,REFERRER_ID, model, sessionStatus);
assertEquals("redirect:/app/admin/preferences?action=update&referringPageId=" + REFERRER_ID, view);
assertTrue("Model has been cleared", model.isEmpty());
verify(service, sessionStatus);
}