CompositeActionMapperTestpublic class CompositeActionMapperTest extends TestCase
Fields Summary |
---|
CompositeActionMapper | compositeActionMapper | com.mockobjects.dynamic.Mock | mockContainer |
Methods Summary |
---|
public void | setUp()
compositeActionMapper = new CompositeActionMapper();
mockContainer = new Mock(Container.class);
compositeActionMapper.setContainer((Container)mockContainer.proxy());
| public void | testGetActionMappingAndUri1()
ActionMapper mapper1 = new InnerActionMapper1();
ActionMapper mapper2 = new InnerActionMapper2();
ActionMapper mapper3 = new InnerActionMapper3();
mockContainer.expectAndReturn("getInstance", C.args(C.eq(ActionMapper.class), C.eq("mapper1")), mapper1);
mockContainer.expectAndReturn("getInstance", C.args(C.eq(ActionMapper.class), C.eq("mapper2")), mapper3);
mockContainer.expectAndReturn("getInstance", C.args(C.eq(ActionMapper.class), C.eq("mapper3")), mapper2);
compositeActionMapper.setActionMappers("mapper1,mapper2,mapper3");
ActionMapping actionMapping = compositeActionMapper.getMapping(new MockHttpServletRequest(), new ConfigurationManager());
String uri = compositeActionMapper.getUriFromActionMapping(new ActionMapping());
mockContainer.verify();
assertNotNull(actionMapping);
assertNotNull(uri);
assertTrue(actionMapping == InnerActionMapper3.actionMapping);
assertTrue(uri == InnerActionMapper3.uri);
| public void | testGetActionMappingAndUri2()
ActionMapper mapper1 = new InnerActionMapper1();
ActionMapper mapper2 = new InnerActionMapper2();
mockContainer.expectAndReturn("getInstance", C.args(C.eq(ActionMapper.class), C.eq("mapper1")), mapper1);
mockContainer.expectAndReturn("getInstance", C.args(C.eq(ActionMapper.class), C.eq("mapper2")), mapper2);
compositeActionMapper.setActionMappers("mapper1,mapper2");
ActionMapping actionMapping = compositeActionMapper.getMapping(new MockHttpServletRequest(), new ConfigurationManager());
String uri = compositeActionMapper.getUriFromActionMapping(new ActionMapping());
mockContainer.verify();
assertNull(actionMapping);
assertNull(uri);
|
|