}
public void testAssociateSurveyImageEntry() throws Throwable {
Survey survey = this.prepareSurveyForTest(true, false);
Survey actual = null;
SurveyAction action = null;
String result = null;
try {
this.setUserOnSession("admin");
this.getSurveyManager().saveSurvey(survey);
assertNotNull(survey);
// Test with invalid strutsAction
this.initAction("/do/jpsurvey/Survey", "associateSurveyImageEntry");
this.addParameter("surveyId", survey.getId());
this.addParameter("questionnaire", true);
this.addParameter("checkCookie", true);
this.addParameter("description-it", "mucca");
this.addParameter("title-it", "lilla");
this.addParameter("imageDescription-it", "cioccolatosa");
this.addParameter("resourceTypeCode", "Image");
this.addParameter("groupName", Group.FREE_GROUP_NAME);
this.addParameter("startDate", "10/06/2009");
this.addParameter("strutsAction", ApsAdminSystemConstants.ADD);
this.addParameter("profileUser", 0);
this.addParameter("gatherUserInfo", survey.isGatherUserInfo());
this.addParameter("imageId", 22);
result = this.executeAction();
action = (SurveyAction) this.getAction();
assertNotNull(result);
assertEquals(action.INPUT, result);
assertEquals((Integer)survey.getId(), action.getSurveyId());
// test with valid parameters
this.initAction("/do/jpsurvey/Survey", "associateSurveyImageEntry");
this.addParameter("surveyId", survey.getId());
// this.addParameter("questionnaire", true);
this.addParameter("checkCookie", false);
this.addParameter("description-it", "mucca");
this.addParameter("title-it", "lilla");
this.addParameter("imageDescription-it", "cioccolatosa");
this.addParameter("resourceTypeCode", "Image");
this.addParameter("groupName", Group.FREE_GROUP_NAME);
this.addParameter("startDate", "10/06/2009");
this.addParameter("strutsAction", ApsAdminSystemConstants.EDIT);
this.addParameter("profileUser", 0);
this.addParameter("gatherUserInfo", survey.isGatherUserInfo());
this.addParameter("imageId", 22);
result = this.executeAction();
action = (SurveyAction) this.getAction();
assertNotNull(result);
assertEquals(action.SUCCESS, result);
assertNotNull(action.getSurveyId());
actual = this.getSurveyManager().loadSurvey(survey.getId());
assertEquals("cioccolatosa", actual.getImageDescriptions().get("it"));
} catch (Throwable t) {
throw t;
} finally {