Page { public static Page singlePage(int page) { if (page < 0) { throw new IllegalArgumentException("Invalid pages: (" + page + " ," + page + ")"); } return new Page(page, page); } private  Page(int start, int end); static Page allPages(); static Page singlePage(int page); static Page pageRange(int start, int end);  }
@Test public void testSinglePage() throws Exception { Page page = Page.singlePage(1); assertEquals(page.end, page.start); assertEquals(page.start, 1); }