⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pagetest.java

📁 应用泛型以及反射编写的单表操作框架
💻 JAVA
字号:
package org.langsin.core.dao.support.test;

import junit.framework.TestCase;

import org.langsin.core.dao.support.Page;
/**
 * 分页类的测试
 * @author 不落的太阳
 *
 */

public class PageTest extends TestCase {

	public void testWithDefaultData() throws Exception {
		Page page = new Page();
		assertEquals(0, page.getTotalPageCount());
		assertEquals(1, page.getCurrentPageNo());
		assertFalse(page.hasNextPage());
		assertFalse(page.hasPreviousPage());
	}

	public void testWithSimpleData() throws Exception {
		Page page = new Page(0, 100, 20, new Object());
		assertEquals(5, page.getTotalPageCount());
		assertEquals(1, page.getCurrentPageNo());
		assertTrue(page.hasNextPage());
		assertFalse(page.hasPreviousPage());
	}

	public void testWithNormalData() throws Exception {
		Page page = new Page(316, 1512, 25, new Object());
		assertEquals(61, page.getTotalPageCount());
		assertEquals(13, page.getCurrentPageNo());
		assertTrue(page.hasNextPage());
		assertTrue(page.hasPreviousPage());
	}

	public void testGetStartOfPage() throws Exception {
		assertEquals(0, Page.getStartOfPage(1, 20));
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -