BATCH-1456: add dummy 2.0 schema and a detector for the wrong schema declaration.

This commit is contained in:
dsyer
2009-12-04 18:36:05 +00:00
parent f3cb6304a2
commit b451c219bf
6 changed files with 78 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import static org.junit.Assert.fail;
import org.junit.Test;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -48,4 +49,20 @@ public class JobParserExceptionTests {
}
}
@Test
public void testWrongSchemaInRoot() {
try {
new ClassPathXmlApplicationContext(
"org/springframework/batch/core/configuration/xml/JobParserWrongSchemaInRootTests-context.xml");
fail("Error expected");
}
catch (BeanDefinitionParsingException e) {
String message = e.getMessage();
assertTrue("Wrong message: "+message, message.matches("(?s).*You cannot use spring-batch-2.0.xsd.*"));
} catch (BeanDefinitionStoreException e) {
// Probably the internet is not available and the schema validation failed.
// We don't want an automated build to fail if that happens.
}
}
}