Package com.agiletec.plugins.jpsurvey.apsadmin.survey

Examples of com.agiletec.plugins.jpsurvey.apsadmin.survey.ChoiceAction


    }
  }
 
  public void testFreeTextList() throws Throwable {
    String result = null;
    ChoiceAction action = null;
    try {
      this.setUserOnSession("admin");
     
      // invoke without parameters
      this.initAction("/do/jpsurvey/Survey", "freeTextList");
      result = this.executeAction();
      assertNotNull(result);
      assertEquals(BaseAction.INPUT, result);
     
      // invoke with invalid choice ID
      this.initAction("/do/jpsurvey/Survey", "freeTextList");
      this.addParameter("choiceId", -1);
      this.addParameter("questionId", 2);
      result = this.executeAction();
     
      assertNotNull(result);
      assertEquals(BaseAction.SUCCESS, result);
      action = (ChoiceAction) this.getAction();
      assertNotNull(action.getFreeTextMap());
      assertTrue(action.getFreeTextMap().isEmpty());
     
      // invoke with NON free text choice ID
      this.initAction("/do/jpsurvey/Survey", "freeTextList");
      this.addParameter("choiceId", 2);
      this.addParameter("questionId", 2);
      result = this.executeAction();
      assertNotNull(result);
      assertEquals(BaseAction.SUCCESS, result);
      action = (ChoiceAction) this.getAction();
      assertNotNull(action.getFreeTextMap());
      assertTrue(action.getFreeTextMap().isEmpty());
     
      this.initAction("/do/jpsurvey/Survey", "freeTextList");
      this.addParameter("choiceId", 6);
      this.addParameter("questionId", 2);
      result = this.executeAction();
      assertNotNull(result);
      assertEquals(BaseAction.SUCCESS, result);
      action = (ChoiceAction) this.getAction();
      assertNotNull(action.getFreeTextMap());
      assertFalse(action.getFreeTextMap().isEmpty());
      assertEquals(1, action.getFreeTextMap().size());
      assertEquals(Integer.valueOf(1), action.getFreeTextMap().get("lorem ipsum dolor"));
    } catch (Throwable t) {
      throw t;
    }
  }
View Full Code Here


    }
  }
 
  public void testTrashChoice() throws Throwable {
    String result = null;
    ChoiceAction action = null;
    try {
      this.setUserOnSession("admin");
     
      // invoke without parameters
      this.initAction("/do/jpsurvey/Survey", "trashChoice");
      result = this.executeAction();
      assertNotNull(result);
      assertEquals(BaseAction.INPUT, result);
     
      // invoke with invalid choice ID
      this.initAction("/do/jpsurvey/Survey", "trashChoice");
      this.addParameter("choiceId", -1);
      result = this.executeAction();
      assertNotNull(result);
      assertEquals(BaseAction.SUCCESS, result);
      action = (ChoiceAction) this.getAction();
      assertNotNull(action.getChoices());
      assertTrue(action.getChoices().isEmpty());
     
      // invoke with known choice ID
      this.initAction("/do/jpsurvey/Survey", "trashChoice");
      this.addParameter("choiceId", 1);
      result = this.executeAction();
      assertNotNull(result);
      assertEquals(BaseAction.SUCCESS, result);
      action = (ChoiceAction) this.getAction();
      assertNotNull(action.getChoices());
      assertEquals(false, action.getChoice().getChoices().isEmpty());
     
      // invoke with known choice ID
      this.initAction("/do/jpsurvey/Survey", "trashChoice");
      this.addParameter("choiceId", 6);
      result = this.executeAction();
      assertNotNull(result);
      assertEquals(BaseAction.SUCCESS, result);
      action = (ChoiceAction) this.getAction();
      assertNotNull(action.getChoice());
    } catch (Throwable t) {
      throw t;
    }
  }
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jpsurvey.apsadmin.survey.ChoiceAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.