package com.aperture_software.glados_wiki.tests; import com.aperture_software.glados_wiki.junit.MyTestcase; import com.aperture_software.glados_wiki.support.Pagination; import junit.framework.Assert; import org.junit.Ignore; import org.junit.Test; /** * Created by jhyun on 13. 12. 21. */ @Ignore public class PaginationTest extends MyTestcase { @Test public void testMaxPage_zero() { // Pagination p1 = new Pagination(0, 0, 0); Assert.assertEquals(p1.getMaxPage(), 0); } @Test public void testMaxPage_zero2() { // Pagination p1 = new Pagination(10, 0, 0); Assert.assertEquals(p1.getMaxPage(), 1); } @Test public void testMaxPage_ceil() { // Pagination p1 = new Pagination(0, 0, 10); Assert.assertEquals(p1.getMaxPage(), 1); // Pagination p2 = new Pagination(3, 0, 10); Assert.assertEquals(p2.getMaxPage(), 1); // Pagination p3 = new Pagination(10, 0, 10); Assert.assertEquals(p3.getMaxPage(), 1); // Pagination p4 = new Pagination(13, 0, 10); Assert.assertEquals(p4.getMaxPage(), 2); // Pagination p5 = new Pagination(15, 0, 10); Assert.assertEquals(p5.getMaxPage(), 2); // Pagination p6 = new Pagination(19, 0, 10); Assert.assertEquals(p6.getMaxPage(), 2); // Pagination p7 = new Pagination(20, 0, 10); Assert.assertEquals(p7.getMaxPage(), 2); // Pagination p8 = new Pagination(21, 0, 10); Assert.assertEquals(p8.getMaxPage(), 3); } @Test public void testCurrentPage_zero() { // Pagination p1 = new Pagination(0, 0, 0); Assert.assertEquals(p1.getCurrentPage(), 0); // Pagination p2 = new Pagination(10, 0, 0); Assert.assertEquals(p2.getCurrentPage(), 0); } @Test public void testCurrentPage() { // Pagination p1 = new Pagination(1000, 0, 10); Assert.assertEquals(p1.getCurrentPage(), 0); // Pagination p2 = new Pagination(1000, 10, 10); Assert.assertEquals(p2.getCurrentPage(), 1); // Pagination p3 = new Pagination(1000, 3, 10); Assert.assertEquals(p3.getCurrentPage(), 1); // Pagination p4 = new Pagination(1000, 13, 10); Assert.assertEquals(p4.getCurrentPage(), 2); // Pagination p5 = new Pagination(1000, 20, 10); Assert.assertEquals(p5.getCurrentPage(), 2); // Pagination p6 = new Pagination(1000, 1000 - 10, 10); Assert.assertEquals(p6.getCurrentPage(), p6.getMaxPage() - 1); // FIXME: Pagination p8 = new Pagination(1000, 1000 - 9, 10); Assert.assertEquals(p8.getCurrentPage(), p8.getMaxPage() - 1); } }