1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.betwixt.strategy;
19
20 import org.apache.commons.betwixt.AbstractTestCase;
21 import org.apache.commons.betwixt.BindingConfiguration;
22 import org.apache.commons.betwixt.LibraryBeanWithArraySetter;
23 import org.apache.commons.betwixt.io.read.ArrayBindAction;
24 import org.apache.commons.betwixt.io.read.MappingAction;
25 import org.apache.commons.betwixt.io.read.ReadConfiguration;
26 import org.apache.commons.betwixt.io.read.ReadContext;
27 import org.xml.sax.helpers.AttributesImpl;
28
29
30
31
32
33 public class TestBaseMappingStrategy extends AbstractTestCase {
34
35 public TestBaseMappingStrategy(String testName) {
36 super(testName);
37 }
38
39 public void testArrayMapping() throws Exception {
40 ReadContext context = new ReadContext(
41 new BindingConfiguration(),
42 new ReadConfiguration());
43
44 context.pushElement("LibraryBeanWithArraySetter");
45 context.markClassMap(LibraryBeanWithArraySetter.class);
46 context.pushElement("books");
47
48 ActionMappingStrategy strategy = ActionMappingStrategy.DEFAULT;
49 MappingAction action = strategy.getMappingAction("", "books", new AttributesImpl(), context);
50 assertTrue("Should be mapped to an array bind action", action instanceof ArrayBindAction);
51 }
52 }