📄 groupingfiltertest.java
字号:
/* Jacson Copyright (C) 2005 Patrick Carl, pcs_org at users.sf.net This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */package de.spieleck.app.jacson.filter;import de.spieleck.app.jacson.JacsonException;import de.spieleck.app.jacson.JacsonRegistry;import de.spieleck.app.jacson.source.LineChunkSource;import de.spieleck.config.Config;import de.spieleck.config.ConfigNode;import org.xml.sax.InputSource;/** * Test class for GroupingFilter * * @author pcs * @version $Id:$ * @since 0.90 */public class GroupingFilterTest extends FilterTestBase { private GroupingFilter filter = new GroupingFilter(";"); private static final String DATA = "test/data/filter/groupingfilter.data"; private static final int EXPECTED_COUNT = 3; private int count = 0; private static String[] startStrings = { "#DB-Script for WmTipp", "\nCREATE TABLE tipp", "\nCREATE TABLE player" }; private boolean error = false; public void testGroupingFilter() throws Exception{ LineChunkSource src = new LineChunkSource(DATA, false); filter.setDrain(this); String c; while ((c=src.nextChunk()) != null) filter.putChunk(c); assertTrue(count == EXPECTED_COUNT); assertFalse(error); } public void putChunk(String chunk) throws JacsonException { error = !(chunk.startsWith(startStrings[count])); if(error) System.err.println("Chunk mismatch. Expected " + startStrings[count] +", " + "received " + chunk); count++; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -