Ejemplo n.º 1
0
  public void testDoEndTagMultipleWithTextCommentNotNull()
      throws JspException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException {
    TxNode root = new TxNode();
    root.addValue(1);

    tst.setQuestionsTxNodeName("SurveyNodeName");
    TxNode node = new TxNode();
    node.addValue(1);
    node.addMsg("MULTIPLE_WITH_TEXT");
    node.addMsg("Why did you decide not to subscribe to Premium Navigation?");
    node.addMsg("1");
    TxNode childNode = new TxNode();
    childNode.addMsg("Don't need these features");
    childNode.addMsg("Price is too high");

    node.addChild(childNode);
    root.addChild(node);
    IMocksControl RequestControl = EasyMock.createControl();

    HttpServletRequest request = RequestControl.createMock(HttpServletRequest.class);
    EasyMock.expect(request.getAttribute(tst.getQuestionsTxNodeName())).andReturn(root).anyTimes();
    RequestControl.replay();

    IMocksControl pageContextControl = EasyMock.createControl();
    javax.servlet.jsp.PageContext pageContext =
        pageContextControl.createMock(javax.servlet.jsp.PageContext.class);
    EasyMock.expect(pageContext.getRequest()).andReturn(request).anyTimes();

    IMocksControl JspWritersControl = EasyMock.createControl();
    JspWriter jspwriter = JspWritersControl.createMock(JspWriter.class);
    EasyMock.expect(pageContext.getOut()).andReturn(jspwriter);
    pageContextControl.replay();

    tst.setPageContext(pageContext);
    tst.setPageNumber(1);
    tst.setComments("This is test Comments");

    tst.doEndTag();

    String strActual = ((StringBuilder) getValue(tst, "outputText")).toString();

    assertEquals("", strActual);
  }
Ejemplo n.º 2
0
 public void testSetPageNumber()
     throws IllegalArgumentException, NoSuchFieldException, IllegalAccessException {
   int pageNumber = 100;
   tst.setPageNumber(pageNumber);
   assertEquals(pageNumber, getValue(tst, "pageNumber"));
 }