01: /*
02: * ChainBuilder ESB
03: * Visual Enterprise Integration
04: *
05: * Copyright (C) 2006 Bostech Corporation
06: *
07: * This program is free software; you can redistribute it and/or modify
08: * it under the terms of the GNU General Public License as published by
09: * the Free Software Foundation; either version 2 of the License, or
10: * (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc.,59 Temple Place, Suite 330, Boston, MA 02111-1307
20: * USA
21: *
22: *
23: *
24: */
25: package com.bostechcorp.cbesb.migrarion;
26:
27: import java.io.File;
28: import java.util.HashMap;
29: import java.util.Iterator;
30: import java.util.Set;
31:
32: import com.bostechcorp.cbesb.migration.x12.X12Fields;
33: import com.bostechcorp.cbesb.migration.x12.X12Fields.X12Field;
34:
35: import junit.framework.TestCase;
36:
37: public class TestFields extends TestCase {
38:
39: public void testFieldNoLen() {
40: File sourceFile = new File("target/test-data/in/fields3");
41: X12Fields instance = new X12Fields();
42: HashMap fmap = instance.load(sourceFile);
43: try {
44: Set keys = fmap.keySet();
45: System.out.println("size:" + fmap.size());
46: for (Iterator i = keys.iterator(); i.hasNext();) {
47: String key = (String) i.next();
48: X12Field field = (X12Field) fmap.get(key);
49:
50: if (field.getId().equals("3")) {
51: System.out.println("name is: " + field.getName());
52: assertEquals(null, field.getMinLen());
53: assertEquals(null, field.getMaxLen());
54: System.out.println("MaxLen is :"
55: + field.getMaxLen() + " Minlen is: "
56: + field.getMinLen());
57: }
58:
59: }
60:
61: } catch (Exception ex) {
62: System.err.println(ex.getMessage());
63:
64: }
65: }
66: }
|