Skip to content

Commit 321e566

Browse files
committed
xml error location
1 parent 802a0e1 commit 321e566

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/test/java/org/apache/ibatis/builder/XmlMapperBuilderTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,14 @@ public void erorrResultMapLocation() throws Exception {
198198
try (InputStream inputStream = Resources.getResourceAsStream(resource)) {
199199
XMLMapperBuilder builder = new XMLMapperBuilder(inputStream, configuration, resource, configuration.getSqlFragments());
200200
builder.parse();
201-
MappedStatement mappedStatement = configuration.getMappedStatement("findProblemTypeTest");
201+
String resultMapName = "java.lang.String";
202+
// namespace + "." + id
203+
String statementId = "org.mybatis.spring.ErrorProblemMapper" + "." + "findProblemResultMapTest";
204+
// same as MapperBuilderAssistant.getStatementResultMaps Exception message
205+
String message = "Could not find result map '" + resultMapName + "' referenced from '" + statementId + "'";
206+
IncompleteElementException exception = Assertions.assertThrows(IncompleteElementException.class,
207+
()-> configuration.getMappedStatement("findProblemTypeTest"));
208+
assertThat(exception.getMessage()).isEqualTo(message);
202209
}
203210
}
204211
}

0 commit comments

Comments
 (0)