public class TestSurveyManager extends ApsPluginBaseTestCase {
public void testLoadSurvey() throws Throwable {
Survey survey = null;
ApsProperties prop = null;
try {
survey = this.getSurveyManager().loadSurvey(0);
assertNull(survey);
survey = this.getSurveyManager().loadSurvey(1);
assertNotNull(survey);
assertEquals("ignored", survey.getGroupName());
assertNotNull(survey.getDescriptions());
assertTrue(survey.isActive());
assertTrue(survey.isGatherUserInfo());
assertTrue(survey.isPublicResult());
assertFalse(survey.isPublicPartialResult());
assertTrue(survey.isQuestionnaire());
assertNotNull(survey.getTitles());
assertFalse(survey.isRestricted());
assertNotNull(survey.getQuestions());
assertFalse(survey.getQuestions().isEmpty());
assertEquals(2, survey.getQuestions().size());
assertEquals("IMG001", survey.getImageId());
prop = survey.getImageDescriptions();
assertEquals("Barrali di notte", prop.getProperty("it"));
// questions must belong to the same survey
assertTrue(survey.getQuestions().get(0).getSurveyId() == survey.getId());
assertTrue(survey.getQuestions().get(0).getSurveyId() == survey.getQuestions().get(1).getSurveyId());
assertNotNull(survey.getQuestions().get(0).getChoices());
// check choices size