01: /*
02: * RegexModifierTest.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.db.importer.modifier;
13:
14: import junit.framework.TestCase;
15: import workbench.db.ColumnIdentifier;
16:
17: /**
18: *
19: * @author support@sql-workbench.net
20: */
21: public class RegexModifierTest extends TestCase {
22: public RegexModifierTest(String testName) {
23: super (testName);
24: }
25:
26: public void testModifyValue() {
27: RegexModifier modifier = new RegexModifier();
28:
29: ColumnIdentifier fname = new ColumnIdentifier("fname");
30: ColumnIdentifier lname = new ColumnIdentifier("lname");
31: modifier.addDefinition(fname, "bronx", "brox");
32: modifier.addDefinition(lname, "\\\"", "\\'");
33:
34: String modified = modifier.modifyValue(fname,
35: "Zaphod Beeblebronx");
36: assertEquals("Zaphod Beeblebrox", modified);
37:
38: modified = modifier.modifyValue(lname, "Zaphod Beeblebronx");
39: assertEquals("Zaphod Beeblebronx", modified);
40:
41: modified = modifier.modifyValue(lname, "Test\" value");
42: System.out.println(modified);
43:
44: }
45: }
|