コード例 #1
0
 public void testTagFirstPage() throws Exception {
   tag.doStartTag();
   tag.doEndTag();
   String result = writer.toString();
   assertTrue("page.size=10: " + result, result.contains("page.size=10"));
   assertTrue("page.page=1: " + result, result.contains("page.page=1"));
   assertTrue("page.page=2: " + result, result.contains("page.page=2"));
 }
コード例 #2
0
 public void testTagNegativePage() throws Exception {
   tag.setPage(-1);
   tag.doStartTag();
   tag.doEndTag();
   String result = writer.toString();
   assertTrue("page.size=10: " + result, result.contains("page.size=10"));
   assertFalse("page.page=-1: " + result, result.contains("page.page=-1"));
   assertFalse("page.page=0: " + result, result.contains("page.page=0"));
   assertTrue("page.page=1: " + result, result.contains("page.page=1"));
   assertTrue("page.page=2: " + result, result.contains("page.page=2"));
 }
コード例 #3
0
 public void testTagCurrentUrl() throws Exception {
   request.setQueryString(null);
   request.setServerName("www.example.com");
   request.setContextPath("");
   request.setServletPath("/page");
   request.setPathInfo(null);
   tag.setLink(null);
   tag.doStartTag();
   tag.doEndTag();
   String result = writer.toString();
   assertTrue("page.size=10: " + result, result.contains("page.size=10"));
   assertTrue("page.page=1: " + result, result.contains("page.page=1"));
   assertTrue("page.page=2: " + result, result.contains("page.page=2"));
 }
コード例 #4
0
 @Override
 protected void setUp() throws Exception {
   tag = new PagerTag();
   super.setUp(tag);
   tag.setCount(50);
   tag.setLimit(10);
   tag.setLimitParam("page.size");
   tag.setLink("http://www.example.com/");
   tag.setMaxLinks(3);
   tag.setNextContent(">");
   tag.setPrevContent("<");
   tag.setPage(0);
   tag.setPageParam("page.page");
 }
コード例 #5
0
 @Override
 protected void tearDown() throws Exception {
   tag.release();
   tag = null;
   super.tearDown();
 }