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")); }
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")); }
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")); }