01: package de.regnis.q.sequence.line;
02:
03: import junit.framework.*;
04:
05: import de.regnis.q.sequence.line.simplifier.*;
06:
07: /**
08: * @author Marc Strapetz
09: */
10: public class QSequenceLineSimplifierTest extends TestCase {
11:
12: // Accessing ==============================================================
13:
14: public void testDummySimplifier() {
15: final QSequenceLineSimplifier simplifier = new QSequenceLineDummySimplifier();
16: assertEquals(" nothing\tto simplify \n", new String(simplifier
17: .simplify(" nothing\tto simplify \n".getBytes())));
18: }
19:
20: public void testSkippingSimplifier() {
21: final QSequenceLineSimplifier simplifier = new QSequenceLineWhiteSpaceSkippingSimplifier();
22: assertEquals("muchtosimplify", new String(simplifier
23: .simplify(" much to simplify ".getBytes())));
24: assertEquals("muchtosimplify\n", new String(simplifier
25: .simplify(" much\tto simplify \n ".getBytes())));
26: }
27:
28: public void testReducingSimplifier() {
29: final QSequenceLineSimplifier simplifier = new QSequenceLineWhiteSpaceReducingSimplifier();
30: assertEquals(" something to simplify ",
31: new String(simplifier
32: .simplify(" something\t to simplify \t "
33: .getBytes())));
34: assertEquals(" something to simplify\n", new String(simplifier
35: .simplify(" something\t to simplify\n".getBytes())));
36: }
37:
38: public void testEolSkippingSimplifier() {
39: final QSequenceLineSimplifier simplifier = new QSequenceLineTeeSimplifier(
40: new QSequenceLineWhiteSpaceReducingSimplifier(),
41: new QSequenceLineEOLUnifyingSimplifier());
42: assertEquals(" something to simplify\n", new String(simplifier
43: .simplify(" something\t to simplify\n\r".getBytes())));
44: }
45: }
|