use of org.apache.ibatis.session.Configuration in project mybatis-3 by mybatis.
the class XmlMapperBuilderTest method createInstanceWithAbstractClass.
@Test
public void createInstanceWithAbstractClass() {
BaseBuilder builder = new BaseBuilder(new Configuration()) {
{
}
};
expectedException.expect(BuilderException.class);
expectedException.expectMessage(is("Error creating instance. Cause: java.lang.InstantiationException: org.apache.ibatis.builder.BaseBuilder"));
builder.createInstance("org.apache.ibatis.builder.BaseBuilder");
}
use of org.apache.ibatis.session.Configuration in project mybatis-3 by mybatis.
the class XmlMapperBuilderTest method useCacheRefNamespaceIsNull.
@Test
public void useCacheRefNamespaceIsNull() {
MapperBuilderAssistant builder = new MapperBuilderAssistant(new Configuration(), "resource");
expectedException.expect(BuilderException.class);
expectedException.expectMessage(is("cache-ref element requires a namespace attribute."));
builder.useCacheRef(null);
}
use of org.apache.ibatis.session.Configuration in project mybatis-3 by mybatis.
the class XmlMapperBuilderTest method resolveClassWithNotFound.
@Test
public void resolveClassWithNotFound() {
BaseBuilder builder = new BaseBuilder(new Configuration()) {
{
}
};
expectedException.expect(BuilderException.class);
expectedException.expectMessage(is("Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'ddd'. Cause: java.lang.ClassNotFoundException: Cannot find class: ddd"));
builder.resolveClass("ddd");
}
use of org.apache.ibatis.session.Configuration in project mybatis-3 by mybatis.
the class XmlMapperBuilderTest method resolveParameterModeWithUndefinedValue.
@Test
public void resolveParameterModeWithUndefinedValue() {
BaseBuilder builder = new BaseBuilder(new Configuration()) {
{
}
};
expectedException.expect(BuilderException.class);
expectedException.expectMessage(startsWith("Error resolving ParameterMode. Cause: java.lang.IllegalArgumentException: No enum"));
expectedException.expectMessage(endsWith("org.apache.ibatis.mapping.ParameterMode.ccc"));
builder.resolveParameterMode("ccc");
}
use of org.apache.ibatis.session.Configuration in project mybatis-3 by mybatis.
the class XmlMapperBuilderTest method mappedStatementWithOptions.
@Test
public void mappedStatementWithOptions() throws Exception {
Configuration configuration = new Configuration();
String resource = "org/apache/ibatis/builder/AuthorMapper.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
XMLMapperBuilder builder = new XMLMapperBuilder(inputStream, configuration, resource, configuration.getSqlFragments());
builder.parse();
MappedStatement mappedStatement = configuration.getMappedStatement("selectWithOptions");
assertThat(mappedStatement.getFetchSize(), is(200));
assertThat(mappedStatement.getTimeout(), is(10));
assertThat(mappedStatement.getStatementType(), is(StatementType.PREPARED));
assertThat(mappedStatement.getResultSetType(), is(ResultSetType.SCROLL_SENSITIVE));
assertThat(mappedStatement.isFlushCacheRequired(), is(false));
assertThat(mappedStatement.isUseCache(), is(false));
}
Aggregations