01: package org.drools.decisiontable.parser;
02:
03: /*
04: * Copyright 2005 JBoss Inc
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License");
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: import java.util.Properties;
20:
21: import junit.framework.TestCase;
22:
23: import org.drools.decisiontable.parser.xls.PropertiesSheetListener;
24:
25: public class PropertiesSheetListenerTest extends TestCase {
26:
27: public void testProperties() {
28: final PropertiesSheetListener listener = new PropertiesSheetListener();
29: listener.startSheet("test");
30:
31: listener.newRow(0, 4);
32:
33: listener.newCell(0, 0, "", SheetListener.NON_MERGED);
34:
35: listener.newCell(0, 1, "key1", SheetListener.NON_MERGED);
36: listener.newCell(0, 2, "value1", SheetListener.NON_MERGED);
37:
38: listener.newRow(1, 4);
39: listener.newCell(1, 1, "key2", SheetListener.NON_MERGED);
40: listener.newCell(1, 3, "value2", SheetListener.NON_MERGED);
41:
42: final Properties props = listener.getProperties();
43:
44: listener.newRow(2, 4);
45: listener.newCell(1, 1, "key3", SheetListener.NON_MERGED);
46:
47: assertEquals("value1", props.getProperty("key1"));
48: assertEquals("value2", props.getProperty("key2"));
49:
50: }
51: }
|