use of org.apache.ibatis.builder.xml.XMLConfigBuilder in project mybatis-3 by mybatis.
the class XmlConfigBuilderTest method parseIsTwice.
@Test
void parseIsTwice() throws Exception {
String resource = "org/apache/ibatis/builder/MinimalMapperConfig.xml";
try (InputStream inputStream = Resources.getResourceAsStream(resource)) {
XMLConfigBuilder builder = new XMLConfigBuilder(inputStream);
builder.parse();
when(builder::parse);
then(caughtException()).isInstanceOf(BuilderException.class).hasMessage("Each XMLConfigBuilder can only be used once.");
}
}
use of org.apache.ibatis.builder.xml.XMLConfigBuilder in project mybatis-3 by mybatis.
the class XmlConfigBuilderTest method unknownJavaTypeOnTypeHandler.
@Test
void unknownJavaTypeOnTypeHandler() {
final String MAPPER_CONFIG = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" + "<!DOCTYPE configuration PUBLIC \"-//mybatis.org//DTD Config 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-config.dtd\">\n" + "<configuration>\n" + " <typeAliases>\n" + " <typeAlias type=\"a.b.c.Foo\"/>\n" + " </typeAliases>\n" + "</configuration>\n";
XMLConfigBuilder builder = new XMLConfigBuilder(new StringReader(MAPPER_CONFIG));
when(builder::parse);
then(caughtException()).isInstanceOf(BuilderException.class).hasMessageContaining("Error registering typeAlias for 'null'. Cause: ");
}
use of org.apache.ibatis.builder.xml.XMLConfigBuilder in project mybatis-3 by mybatis.
the class XmlConfigBuilderTest method propertiesSpecifyResourceAndUrlAtSameTime.
@Test
void propertiesSpecifyResourceAndUrlAtSameTime() {
final String MAPPER_CONFIG = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" + "<!DOCTYPE configuration PUBLIC \"-//mybatis.org//DTD Config 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-config.dtd\">\n" + "<configuration>\n" + " <properties resource=\"a/b/c/foo.properties\" url=\"file:./a/b/c/jdbc.properties\"/>\n" + "</configuration>\n";
XMLConfigBuilder builder = new XMLConfigBuilder(new StringReader(MAPPER_CONFIG));
when(builder::parse);
then(caughtException()).isInstanceOf(BuilderException.class).hasMessageContaining("The properties element cannot specify both a URL and a resource based property file reference. Please specify one or the other.");
}
Aggregations