use of org.apache.ibatis.binding.MapperMethod in project javaBook-src by huifer.
the class SqlProviderTest method methodOverload.
@Test
void methodOverload() throws NoSuchMethodException {
try {
Class<?> mapperType = ErrorMapper.class;
Method mapperMethod = mapperType.getMethod("methodOverload", String.class);
new ProviderSqlSource(new Configuration(), mapperMethod.getAnnotation(SelectProvider.class), mapperType, mapperMethod);
fail();
} catch (BuilderException e) {
assertTrue(e.getMessage().contains("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."));
}
}
use of org.apache.ibatis.binding.MapperMethod in project javaBook-src by huifer.
the class SqlProviderTest method methodNotFound.
@Test
void methodNotFound() throws NoSuchMethodException {
try {
Class<?> mapperType = ErrorMapper.class;
Method mapperMethod = mapperType.getMethod("methodNotFound");
new ProviderSqlSource(new Configuration(), mapperMethod.getAnnotation(SelectProvider.class), mapperType, mapperMethod);
fail();
} catch (BuilderException e) {
assertTrue(e.getMessage().contains("Error creating SqlSource for SqlProvider. Method 'methodNotFound' not found in SqlProvider 'org.apache.ibatis.submitted.sqlprovider.SqlProviderTest$ErrorSqlBuilder'."));
}
}
use of org.apache.ibatis.binding.MapperMethod in project javaBook-src by huifer.
the class SqlProviderTest method omitType.
@Test
void omitType() throws NoSuchMethodException {
try {
Class<?> mapperType = ErrorMapper.class;
Method mapperMethod = mapperType.getMethod("omitType");
new ProviderSqlSource(new Configuration(), mapperMethod.getAnnotation(SelectProvider.class), mapperType, mapperMethod);
fail();
} catch (BuilderException e) {
assertTrue(e.getMessage().contains("Please specify either 'value' or 'type' attribute of @SelectProvider at the 'public abstract void org.apache.ibatis.submitted.sqlprovider.SqlProviderTest$ErrorMapper.omitType()'."));
}
}
use of org.apache.ibatis.binding.MapperMethod in project javaBook-src by huifer.
the class SqlProviderTest method invokeNestedError.
@Test
void invokeNestedError() throws NoSuchMethodException {
try {
Class<?> mapperType = ErrorMapper.class;
Method mapperMethod = mapperType.getMethod("invokeNestedError");
new ProviderSqlSource(new Configuration(), mapperMethod.getAnnotation(SelectProvider.class), mapperType, mapperMethod).getBoundSql(new Object());
fail();
} catch (BuilderException e) {
assertTrue(e.getMessage().contains("Error invoking SqlProvider method 'public java.lang.String org.apache.ibatis.submitted.sqlprovider.SqlProviderTest$ErrorSqlBuilder.invokeNestedError()' with specify parameter 'class java.lang.Object'. Cause: java.lang.UnsupportedOperationException: invokeNestedError"));
}
}
use of org.apache.ibatis.binding.MapperMethod in project javaBook-src by huifer.
the class SqlProviderTest method invokeError.
@Test
void invokeError() throws NoSuchMethodException {
try {
Class<?> mapperType = ErrorMapper.class;
Method mapperMethod = mapperType.getMethod("invokeError");
new ProviderSqlSource(new Configuration(), mapperMethod.getAnnotation(SelectProvider.class), mapperType, mapperMethod).getBoundSql(new Object());
fail();
} catch (BuilderException e) {
assertTrue(e.getMessage().contains("Error invoking SqlProvider method 'public java.lang.String org.apache.ibatis.submitted.sqlprovider.SqlProviderTest$ErrorSqlBuilder.invokeError()' with specify parameter 'class java.lang.Object'. Cause: java.lang.UnsupportedOperationException: invokeError"));
}
}
Aggregations