use of org.apache.ibatis.session.Configuration in project mybatis-3 by mybatis.
the class DynamicSqlSourceTest method shouldTrimNoSetClause.
@Test
public void shouldTrimNoSetClause() throws Exception {
final String expected = "UPDATE BLOG";
DynamicSqlSource source = createDynamicSqlSource(new TextSqlNode("UPDATE BLOG"), new SetSqlNode(new Configuration(), mixedContents(new IfSqlNode(mixedContents(new TextSqlNode(" , ID = ? ")), "false"), new IfSqlNode(mixedContents(new TextSqlNode(", NAME = ? ")), "false"))));
BoundSql boundSql = source.getBoundSql(null);
assertEquals(expected, boundSql.getSql());
}
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");
}
Aggregations