use of org.apache.ibatis.builder.annotation.ProviderSqlSource in project mybatis-3 by mybatis.
the class SqlProviderTest method notSupportParameterObjectOnNamedArgument.
@Test
public void notSupportParameterObjectOnNamedArgument() throws NoSuchMethodException {
expectedException.expect(BuilderException.class);
expectedException.expectMessage(is("Error invoking SqlProvider method (org.apache.ibatis.submitted.sqlprovider.OurSqlBuilder.buildGetUsersByNameWithParamNameQuery). Cannot invoke a method that holds named argument(@Param) using a specifying parameterObject. In this case, please specify a 'java.util.Map' object."));
new ProviderSqlSource(new Configuration(), Mapper.class.getMethod("getUsersByNameWithParamName", String.class).getAnnotation(SelectProvider.class)).getBoundSql(new Object());
}
use of org.apache.ibatis.builder.annotation.ProviderSqlSource in project mybatis-3 by mybatis.
the class SqlProviderTest method methodOverload.
@Test
public void methodOverload() throws NoSuchMethodException {
expectedException.expect(BuilderException.class);
expectedException.expectMessage(is("Error creating SqlSource for SqlProvider. Method 'overload' is found multiple in SqlProvider 'org.apache.ibatis.submitted.sqlprovider.SqlProviderTest$ErrorSqlBuilder'. Sql provider method can not overload."));
new ProviderSqlSource(new Configuration(), ErrorMapper.class.getMethod("methodOverload", String.class).getAnnotation(SelectProvider.class));
}
use of org.apache.ibatis.builder.annotation.ProviderSqlSource in project mybatis-3 by mybatis.
the class SqlProviderTest method notSupportParameterObjectOnMultipleArguments.
@Test
public void notSupportParameterObjectOnMultipleArguments() throws NoSuchMethodException {
expectedException.expect(BuilderException.class);
expectedException.expectMessage(is("Error invoking SqlProvider method (org.apache.ibatis.submitted.sqlprovider.OurSqlBuilder.buildGetUsersByNameQuery). Cannot invoke a method that holds multiple arguments using a specifying parameterObject. In this case, please specify a 'java.util.Map' object."));
new ProviderSqlSource(new Configuration(), Mapper.class.getMethod("getUsersByName", String.class, String.class).getAnnotation(SelectProvider.class)).getBoundSql(new Object());
}
use of org.apache.ibatis.builder.annotation.ProviderSqlSource in project mybatis-3 by mybatis.
the class SqlProviderTest method invokeError.
@Test
public void invokeError() throws NoSuchMethodException {
expectedException.expect(BuilderException.class);
expectedException.expectMessage(is("Error invoking SqlProvider method (org.apache.ibatis.submitted.sqlprovider.SqlProviderTest$ErrorSqlBuilder.invokeError). Cause: java.lang.reflect.InvocationTargetException"));
new ProviderSqlSource(new Configuration(), ErrorMapper.class.getMethod("invokeError").getAnnotation(SelectProvider.class)).getBoundSql(new Object());
}
use of org.apache.ibatis.builder.annotation.ProviderSqlSource in project mybatis-3 by mybatis.
the class SqlProviderTest method notSqlProvider.
@Test
public void notSqlProvider() throws NoSuchMethodException {
expectedException.expect(BuilderException.class);
expectedException.expectMessage(is("Error creating SqlSource for SqlProvider. Cause: java.lang.NoSuchMethodException: java.lang.Object.type()"));
new ProviderSqlSource(new Configuration(), new Object());
}
Aggregations