|
22 | 22 | import static org.junit.jupiter.api.Assertions.fail;
|
23 | 23 |
|
24 | 24 | import java.io.Reader;
|
25 |
| -import java.lang.annotation.Annotation; |
26 | 25 | import java.lang.reflect.Method;
|
27 | 26 | import java.util.ArrayList;
|
28 | 27 | import java.util.Collections;
|
@@ -391,6 +390,20 @@ void invokeError() throws NoSuchMethodException {
|
391 | 390 | }
|
392 | 391 | }
|
393 | 392 |
|
| 393 | + @Test |
| 394 | + void invokeNestedError() throws NoSuchMethodException { |
| 395 | + try { |
| 396 | + Class<?> mapperType = ErrorMapper.class; |
| 397 | + Method mapperMethod = mapperType.getMethod("invokeNestedError"); |
| 398 | + new ProviderSqlSource(new Configuration(), |
| 399 | + mapperMethod.getAnnotation(SelectProvider.class), mapperType, mapperMethod) |
| 400 | + .getBoundSql(new Object()); |
| 401 | + fail(); |
| 402 | + } catch (BuilderException e) { |
| 403 | + 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")); |
| 404 | + } |
| 405 | + } |
| 406 | + |
394 | 407 | @Test
|
395 | 408 | void invalidArgumentsCombination() throws NoSuchMethodException {
|
396 | 409 | try {
|
@@ -670,6 +683,9 @@ public interface ErrorMapper {
|
670 | 683 | @SelectProvider(type = ErrorSqlBuilder.class, method = "invokeError")
|
671 | 684 | void invokeError();
|
672 | 685 |
|
| 686 | + @SelectProvider(type = ErrorSqlBuilder.class, method = "invokeNestedError") |
| 687 | + void invokeNestedError(); |
| 688 | + |
673 | 689 | @SelectProvider(type = ErrorSqlBuilder.class, method = "multipleProviderContext")
|
674 | 690 | void multipleProviderContext();
|
675 | 691 |
|
@@ -702,6 +718,10 @@ public String invokeError() {
|
702 | 718 | throw new UnsupportedOperationException("invokeError");
|
703 | 719 | }
|
704 | 720 |
|
| 721 | + public String invokeNestedError() { |
| 722 | + throw new IllegalStateException(new UnsupportedOperationException("invokeNestedError")); |
| 723 | + } |
| 724 | + |
705 | 725 | public String multipleProviderContext(ProviderContext providerContext1, ProviderContext providerContext2) {
|
706 | 726 | throw new UnsupportedOperationException("multipleProviderContext");
|
707 | 727 | }
|
|
0 commit comments