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