@Test
public void testEmptyElementWithReference() {
ResourceList rl = new ResourceList();
rl.setEncoding("foo");
try {
rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
fail("Can add reference to ResourceList with encoding attribute set.");
} catch (BuildException be) {
assertEquals("You must not specify more than one attribute when using refid",
be.getMessage());
}
rl = new ResourceList();
rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
try {
rl.setEncoding("foo");
fail("Can set encoding in ResourceList that is a reference");
} catch (BuildException be) {
assertEquals("You must not specify more than one attribute when using refid",
be.getMessage());
}
rl = new ResourceList();
rl.add(new FileResource(buildRule.getProject(), "."));
try {
rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
fail("Can add reference to ResourceList with nested resource collection.");
} catch (BuildException be) {
assertEquals("You must not specify nested elements when using refid",
be.getMessage());
}
rl = new ResourceList();
rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
try {
rl.add(new FileResource(buildRule.getProject(), "."));
fail("Can add reference to ResourceList with nested resource collection.");
} catch (BuildException be) {
assertEquals("You must not specify nested elements when using refid",
be.getMessage());
}
rl = new ResourceList();
rl.addFilterChain(new FilterChain());
try {
rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
fail("Can add reference to ResourceList with nested filter chain.");
} catch (BuildException be) {
assertEquals("You must not specify nested elements when using refid",
be.getMessage());
}
rl = new ResourceList();
rl.setRefid(new Reference(buildRule.getProject(), "dummyref"));
try {
rl.addFilterChain(new FilterChain());
fail("Can add reference to ResourceList with nested filter chain.");
} catch (BuildException be) {
assertEquals("You must not specify nested elements when using refid",