public void testConditionalExpressionError()
{
MockControl ehControl = newControl(ErrorHandler.class);
ErrorHandler eh = (ErrorHandler) ehControl.getMock();
RegistryDefinition definition = new RegistryDefinitionImpl();
Log log = LogFactory.getLog(XmlModuleDescriptorProcessor.class);
Location location = newLocation();
eh.error(
log,
"Unexpected token <AND> in expression 'and class foo'.",
location,
new RuntimeException());
ehControl.setMatcher(new AggregateArgumentsMatcher(new ArgumentMatcher[]
{ null, null, null, new TypeMatcher() }));
replayControls();
ModuleDescriptor md = new ModuleDescriptor(getClassResolver(), eh);
md.setModuleId("zip.zoop");
ConfigurationPointDescriptor cpd = new ConfigurationPointDescriptor();
cpd.setId("Fred");
md.addConfigurationPoint(cpd);
ContributionDescriptor cd = new ContributionDescriptor();
cd.setConfigurationId("Fred");
cd.setConditionalExpression("and class foo");
cd.setLocation(location);
cd.addElement(newElement("bar"));
md.addContribution(cd);
XmlModuleDescriptorProcessor processor = new XmlModuleDescriptorProcessor(definition, eh);
processor.processModuleDescriptor(md);
ExtensionResolver extensionResolver = new ExtensionResolver(definition, new StrictErrorHandler());
extensionResolver.resolveExtensions();
ConfigurationPointDefinition configurationPoint = definition
.getConfigurationPoint("zip.zoop.Fred");
assertTrue(configurationPoint.getContributions().isEmpty());
verifyControls();