1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.mapping;
17
18 import org.apache.ibatis.session.Configuration;
19 import org.junit.jupiter.api.Assertions;
20 import org.junit.jupiter.api.Test;
21 import org.junit.jupiter.api.extension.ExtendWith;
22 import org.mockito.Mock;
23 import org.mockito.junit.jupiter.MockitoExtension;
24
25 @ExtendWith(MockitoExtension.class)
26 class ResultMappingTest {
27 @Mock
28 private Configuration configuration;
29
30
31 @Test
32 void shouldThrowErrorWhenBothResultMapAndNestedSelectAreSet() {
33 Assertions.assertThrows(IllegalStateException.class, () -> {
34 new ResultMapping.Builder(configuration, "prop")
35 .nestedQueryId("nested query ID")
36 .nestedResultMapId("nested resultMap")
37 .build();
38 });
39 }
40
41
42 @Test
43 void shouldFailWithAMissingColumnInNetstedSelect() {
44 Assertions.assertThrows(IllegalStateException.class, () -> new ResultMapping.Builder(configuration, "prop")
45 .nestedQueryId("nested query ID")
46 .build());
47 }
48
49 }