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, () -> new ResultMapping.Builder(configuration, "prop")
34 .nestedQueryId("nested query ID").nestedResultMapId("nested resultMap").build());
35 }
36
37
38 @Test
39 void shouldFailWithAMissingColumnInNetstedSelect() {
40 Assertions.assertThrows(IllegalStateException.class,
41 () -> new ResultMapping.Builder(configuration, "prop").nestedQueryId("nested query ID").build());
42 }
43
44 }