}
}
public void testJoinImage() throws Throwable {
String result = null;
SurveyImageAction action = null;
Survey backup = null;
Survey survey = null;
try {
this.setUserOnSession("admin");
// test on unknown non existent survey
this.initAction("/do/jpsurvey/Survey", "joinImage");
this.addParameter("resourceId", "IMG69");
this.addParameter("surveyId", -1);
result = this.executeAction();
assertNotNull(result);
assertEquals(Action.SUCCESS, result);
action = (SurveyImageAction) this.getAction();
assertNotNull(action.getResources());
assertFalse(action.getResources().isEmpty());
// test on effective survey
backup = this.getSurveyManager().loadSurvey(1);
if (null != backup) {
this.initAction("/do/jpsurvey/Survey", "joinImage");
this.addParameter("resourceId", "IMG069");
this.addParameter("surveyId", 1);
result = this.executeAction();
assertNotNull(result);
assertEquals(Action.SUCCESS, result);
action = (SurveyImageAction) this.getAction();
assertNotNull(action.getResources());
assertFalse(action.getResources().isEmpty());
survey = this.getSurveyManager().loadSurvey(1);
assertEquals("IMG069", survey.getImageId());
}
} catch (Throwable t) {
throw t;