瀏覽代碼

update testcase

HasegawaTomofumi 7 年之前
父節點
當前提交
57bd6aaa23

+ 63 - 0
src/test/java/org/codelibs/fess/app/pager/CrawlingInfoPagerTest.java

@@ -0,0 +1,63 @@
+/*
+ * Copyright 2012-2018 CodeLibs Project and the Others.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.codelibs.fess.app.pager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.codelibs.fess.unit.UnitFessTestCase;
+
+public class CrawlingInfoPagerTest extends UnitFessTestCase {
+
+    public void test_CrawlingInfoPage() {
+        CrawlingInfoPager crawlinginfopage = new CrawlingInfoPager();
+
+        crawlinginfopage.clear();
+        assertEquals(0, crawlinginfopage.getAllRecordCount());
+        assertEquals(0, crawlinginfopage.getAllPageCount());
+        assertEquals(false, crawlinginfopage.isExistPrePage());
+        assertEquals(false, crawlinginfopage.isExistNextPage());
+        assertEquals(25, crawlinginfopage.getPageSize());
+        assertEquals(1, crawlinginfopage.getCurrentPageNumber());
+        assertNull(crawlinginfopage.id);
+        assertNull(crawlinginfopage.sessionId);
+        assertNull(crawlinginfopage.createdTime);
+
+        assertEquals(1, crawlinginfopage.getDefaultCurrentPageNumber());
+        crawlinginfopage.setAllRecordCount(999);
+        assertEquals(999, crawlinginfopage.getAllRecordCount());
+        crawlinginfopage.setAllPageCount(999);
+        assertEquals(999, crawlinginfopage.getAllPageCount());
+        crawlinginfopage.setExistPrePage(true);
+        assertTrue(crawlinginfopage.isExistPrePage());
+        crawlinginfopage.setExistNextPage(true);
+        assertTrue(crawlinginfopage.isExistNextPage());
+        crawlinginfopage.setPageSize(0);
+        assertEquals(25, crawlinginfopage.getPageSize());
+        crawlinginfopage.setPageSize(999);
+        assertEquals(999, crawlinginfopage.getPageSize());
+        crawlinginfopage.setCurrentPageNumber(0);
+        assertEquals(1, crawlinginfopage.getCurrentPageNumber());
+        crawlinginfopage.setCurrentPageNumber(999);
+        assertEquals(999, crawlinginfopage.getCurrentPageNumber());
+        List<Integer> pageNumberList = new ArrayList<Integer>(1);
+        crawlinginfopage.setPageNumberList(pageNumberList);
+        assertEquals(pageNumberList, crawlinginfopage.getPageNumberList());
+        assertEquals(25, crawlinginfopage.getDefaultPageSize());
+
+    }
+
+}

+ 68 - 0
src/test/java/org/codelibs/fess/app/pager/DataConfigPagerTest.java

@@ -0,0 +1,68 @@
+/*
+ * Copyright 2012-2018 CodeLibs Project and the Others.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.codelibs.fess.app.pager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.codelibs.fess.unit.UnitFessTestCase;
+
+public class DataConfigPagerTest extends UnitFessTestCase {
+
+    public void test_DataConfigPager() {
+        DataConfigPager dataconfigpager = new DataConfigPager();
+
+        dataconfigpager.clear();
+        assertEquals(0, dataconfigpager.getAllRecordCount());
+        assertEquals(0, dataconfigpager.getAllPageCount());
+        assertEquals(false, dataconfigpager.isExistPrePage());
+        assertEquals(false, dataconfigpager.isExistNextPage());
+        assertEquals(25, dataconfigpager.getPageSize());
+        assertEquals(1, dataconfigpager.getCurrentPageNumber());
+        assertNull(dataconfigpager.id);
+        assertNull(dataconfigpager.name);
+        assertNull(dataconfigpager.handlerName);
+        assertNull(dataconfigpager.boost);
+        assertNull(dataconfigpager.available);
+        assertNull(dataconfigpager.sortOrder);
+        assertNull(dataconfigpager.createdBy);
+        assertNull(dataconfigpager.createdTime);
+        assertNull(dataconfigpager.versionNo);
+
+        assertEquals(1, dataconfigpager.getDefaultCurrentPageNumber());
+        dataconfigpager.setAllRecordCount(999);
+        assertEquals(999, dataconfigpager.getAllRecordCount());
+        dataconfigpager.setAllPageCount(999);
+        assertEquals(999, dataconfigpager.getAllPageCount());
+        dataconfigpager.setExistPrePage(true);
+        assertTrue(dataconfigpager.isExistPrePage());
+        dataconfigpager.setExistNextPage(true);
+        assertTrue(dataconfigpager.isExistNextPage());
+        dataconfigpager.setPageSize(0);
+        assertEquals(25, dataconfigpager.getPageSize());
+        dataconfigpager.setPageSize(999);
+        assertEquals(999, dataconfigpager.getPageSize());
+        dataconfigpager.setCurrentPageNumber(0);
+        assertEquals(1, dataconfigpager.getCurrentPageNumber());
+        dataconfigpager.setCurrentPageNumber(999);
+        assertEquals(999, dataconfigpager.getCurrentPageNumber());
+        List<Integer> pageNumberList = new ArrayList<Integer>(1);
+        dataconfigpager.setPageNumberList(pageNumberList);
+        assertEquals(pageNumberList, dataconfigpager.getPageNumberList());
+        assertEquals(25, dataconfigpager.getDefaultPageSize());
+
+    }
+}

+ 65 - 0
src/test/java/org/codelibs/fess/app/pager/DuplicateHostPagerTest.java

@@ -0,0 +1,65 @@
+/*
+ * Copyright 2012-2018 CodeLibs Project and the Others.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.codelibs.fess.app.pager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.codelibs.fess.unit.UnitFessTestCase;
+
+public class DuplicateHostPagerTest extends UnitFessTestCase {
+
+    public void test_DuplicateHostPager() {
+        DuplicateHostPager duplicatehostpager = new DuplicateHostPager();
+
+        duplicatehostpager.clear();
+        assertEquals(0, duplicatehostpager.getAllRecordCount());
+        assertEquals(0, duplicatehostpager.getAllPageCount());
+        assertEquals(false, duplicatehostpager.isExistPrePage());
+        assertEquals(false, duplicatehostpager.isExistNextPage());
+        assertEquals(25, duplicatehostpager.getPageSize());
+        assertEquals(1, duplicatehostpager.getCurrentPageNumber());
+        assertNull(duplicatehostpager.id);
+        assertNull(duplicatehostpager.regularName);
+        assertNull(duplicatehostpager.duplicateHostName);
+        assertNull(duplicatehostpager.sortOrder);
+        assertNull(duplicatehostpager.createdBy);
+        assertNull(duplicatehostpager.createdTime);
+        assertNull(duplicatehostpager.versionNo);
+
+        assertEquals(1, duplicatehostpager.getDefaultCurrentPageNumber());
+        duplicatehostpager.setAllRecordCount(999);
+        assertEquals(999, duplicatehostpager.getAllRecordCount());
+        duplicatehostpager.setAllPageCount(999);
+        assertEquals(999, duplicatehostpager.getAllPageCount());
+        duplicatehostpager.setExistPrePage(true);
+        assertTrue(duplicatehostpager.isExistPrePage());
+        duplicatehostpager.setExistNextPage(true);
+        assertTrue(duplicatehostpager.isExistNextPage());
+        duplicatehostpager.setPageSize(0);
+        assertEquals(25, duplicatehostpager.getPageSize());
+        duplicatehostpager.setPageSize(999);
+        assertEquals(999, duplicatehostpager.getPageSize());
+        duplicatehostpager.setCurrentPageNumber(0);
+        assertEquals(1, duplicatehostpager.getCurrentPageNumber());
+        duplicatehostpager.setCurrentPageNumber(999);
+        assertEquals(999, duplicatehostpager.getCurrentPageNumber());
+        List<Integer> pageNumberList = new ArrayList<Integer>(1);
+        duplicatehostpager.setPageNumberList(pageNumberList);
+        assertEquals(pageNumberList, duplicatehostpager.getPageNumberList());
+        assertEquals(25, duplicatehostpager.getDefaultPageSize());
+    }
+}