use of org.springframework.ui.ExtendedModelMap in project Asqatasun by Asqatasun.
the class AuditSetUpControllerTest method testDisplayPageAuditUploadSetUpWithWrongContractId.
public void testDisplayPageAuditUploadSetUpWithWrongContractId() {
System.out.println("testDisplayPageAuditUploadSetUpWithWrongContractId");
// set-up
setUpMockUserDataServiceAndUser();
setUpMockAuthenticationContext();
setUpMockContractDataService(1, "Contract1");
// the contract Id cannot be converted as a Long. An exception is caught
try {
instance.displayUploadAuditSetUp("Not a number", null, null, new ExtendedModelMap());
assertTrue(false);
} catch (ForbiddenPageException fue) {
assertTrue(true);
}
}
use of org.springframework.ui.ExtendedModelMap in project Asqatasun by Asqatasun.
the class PageListControllerTest method testDisplayPageListWithUnknownAuditId.
/**
* The mockWebResourceDataService contains only 2 WebResource. One has
* Id=1 and is a Page instance, the second has Id=2 and is a Site instance.
* If a webresource with an id different from 1 or 2 is requested, the
* ForbiddenPageException is caught
*
* @throws Exception
*/
public void testDisplayPageListWithUnknownAuditId() throws Exception {
System.out.println("testDisplayPageListWithUnknownAuditId");
setUpMockAuditDataService(UNKNOWN_AUDIT_ID);
MockHttpServletRequest request = new MockHttpServletRequest();
request.addParameter(TgolKeyStore.AUDIT_ID_KEY, String.valueOf(UNKNOWN_AUDIT_ID));
try {
instance.displayPageList(request, new MockHttpServletResponse(), new ExtendedModelMap());
assertTrue(false);
} catch (ForbiddenPageException fbe) {
// The auditDataService catch the NoResultException and return null.
// Then if the audit is null, a ForbiddenPageException is caught
assertTrue(true);
}
}
use of org.springframework.ui.ExtendedModelMap in project Asqatasun by Asqatasun.
the class PageListControllerTest method testDisplayPageListWithoutAuditId.
/**
* The servlet is supposed to embed the audit id the page is
* about. If not, the ForbiddenPageException is caught.
* @throws Exception
*/
public void testDisplayPageListWithoutAuditId() throws Exception {
System.out.println("testDisplayPageListWithoutAuditId");
// about. If not, the access denied page is returned
try {
instance.displayPageList(new MockHttpServletRequest(), new MockHttpServletResponse(), new ExtendedModelMap());
assertTrue(false);
} catch (AuditParameterMissingException fbe) {
assertTrue(true);
}
}
Aggregations