1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.type;
17
18 import static org.junit.jupiter.api.Assertions.assertEquals;
19 import static org.mockito.Mockito.never;
20 import static org.mockito.Mockito.verify;
21 import static org.mockito.Mockito.when;
22
23 import java.math.BigDecimal;
24
25 import org.junit.jupiter.api.Test;
26
27 class BigDecimalTypeHandlerTest extends BaseTypeHandlerTest {
28
29 private static final TypeHandler<BigDecimal> TYPE_HANDLER = new BigDecimalTypeHandler();
30
31 @Override
32 @Test
33 public void shouldSetParameter() throws Exception {
34 TYPE_HANDLER.setParameter(ps, 1, new BigDecimal(1), null);
35 verify(ps).setBigDecimal(1, new BigDecimal(1));
36 }
37
38 @Override
39 @Test
40 public void shouldGetResultFromResultSetByName() throws Exception {
41 when(rs.getBigDecimal("column")).thenReturn(new BigDecimal(1));
42 assertEquals(new BigDecimal(1), TYPE_HANDLER.getResult(rs, "column"));
43 verify(rs, never()).wasNull();
44 }
45
46 @Override
47 public void shouldGetResultNullFromResultSetByName() throws Exception {
48
49 }
50
51 @Override
52 @Test
53 public void shouldGetResultFromResultSetByPosition() throws Exception {
54 when(rs.getBigDecimal(1)).thenReturn(new BigDecimal(1));
55 assertEquals(new BigDecimal(1), TYPE_HANDLER.getResult(rs, 1));
56 verify(rs, never()).wasNull();
57 }
58
59 @Override
60 public void shouldGetResultNullFromResultSetByPosition() throws Exception {
61
62 }
63
64 @Override
65 @Test
66 public void shouldGetResultFromCallableStatement() throws Exception {
67 when(cs.getBigDecimal(1)).thenReturn(new BigDecimal(1));
68 assertEquals(new BigDecimal(1), TYPE_HANDLER.getResult(cs, 1));
69 verify(cs, never()).wasNull();
70 }
71
72 @Override
73 public void shouldGetResultNullFromCallableStatement() throws Exception {
74
75 }
76
77 }