|
8 | 8 | import java.time.LocalDateTime;
|
9 | 9 | import java.time.LocalTime;
|
10 | 10 |
|
| 11 | +import static org.assertj.core.api.Assertions.assertThat; |
| 12 | + |
11 | 13 | /**
|
12 | 14 | * Test model object.
|
13 | 15 | */
|
14 | 16 | public class TestRow {
|
15 | 17 | public static RowMapper<TestRow> ROW_MAPPER = resultSet -> {
|
16 | 18 | TestRow row = new TestRow();
|
| 19 | + |
17 | 20 | // primary key
|
18 |
| - row.setcLong(DataType.LONG.getNullableFromResultSet(resultSet, "c_pk")); |
| 21 | + row.setcPK(DataType.LONG.getNullableFromResultSet(resultSet, "c_pk")); |
19 | 22 | // other columns
|
| 23 | + row.setcBigDecimal(DataType.BIG_DECIMAL.getNullableFromResultSet(resultSet, "c_decimal")); |
20 | 24 | row.setcLocalDate(DataType.DATE.getNullableFromResultSet(resultSet, "c_date"));
|
21 | 25 | row.setcLocalDateTime(DataType.DATE_TIME.getNullableFromResultSet(resultSet, "c_timestamp"));
|
22 | 26 | row.setcDouble(DataType.DOUBLE.getNullableFromResultSet(resultSet, "c_double"));
|
23 | 27 | row.setcInteger(DataType.INTEGER.getNullableFromResultSet(resultSet, "c_integer"));
|
24 | 28 | row.setcLong(DataType.LONG.getNullableFromResultSet(resultSet, "c_bigint"));
|
25 |
| - row.setcString(DataType.STRING.getNullableFromResultSet(resultSet, "c_text")); |
| 29 | + row.setcShortString(DataType.STRING.getNullableFromResultSet(resultSet, "c_varchar")); |
| 30 | + row.setcLongString(DataType.STRING.getNullableFromResultSet(resultSet, "c_text")); |
26 | 31 | row.setcLocalTime(DataType.TIME.getNullableFromResultSet(resultSet, "c_time"));
|
| 32 | + |
| 33 | + // primary key |
| 34 | + assertThat(DataType.LONG.getNullableFromResultSet(resultSet, 1)).isEqualTo(row.getcPK()); |
| 35 | + // other columns |
| 36 | + assertThat(DataType.BIG_DECIMAL.getNullableFromResultSet(resultSet, 2)).isEqualTo(row.getcBigDecimal()); |
| 37 | + assertThat(DataType.DATE.getNullableFromResultSet(resultSet, 3)).isEqualTo(row.getcLocalDate()); |
| 38 | + assertThat(DataType.DATE_TIME.getNullableFromResultSet(resultSet, 4)).isEqualTo(row.getcLocalDateTime()); |
| 39 | + assertThat(DataType.DOUBLE.getNullableFromResultSet(resultSet, 5)).isEqualTo(row.getcDouble()); |
| 40 | + assertThat(DataType.INTEGER.getNullableFromResultSet(resultSet, 6)).isEqualTo(row.getcInteger()); |
| 41 | + assertThat(DataType.LONG.getNullableFromResultSet(resultSet, 7)).isEqualTo(row.getcLong()); |
| 42 | + assertThat(DataType.STRING.getNullableFromResultSet(resultSet, 8)).isEqualTo(row.getcShortString()); |
| 43 | + assertThat(DataType.STRING.getNullableFromResultSet(resultSet, 9)).isEqualTo(row.getcLongString()); |
| 44 | + assertThat(DataType.TIME.getNullableFromResultSet(resultSet, 10)).isEqualTo(row.getcLocalTime()); |
| 45 | + |
27 | 46 | return row;
|
28 | 47 | };
|
29 | 48 |
|
| 49 | + private Long cPK; |
30 | 50 | private BigDecimal cBigDecimal;
|
31 | 51 | private LocalDate cLocalDate;
|
32 | 52 | private LocalDateTime cLocalDateTime;
|
33 | 53 | private Double cDouble;
|
34 | 54 | private Integer cInteger;
|
35 | 55 | private Long cLong;
|
36 |
| - private String cString; |
| 56 | + private String cShortString; |
| 57 | + private String cLongString; |
37 | 58 | private LocalTime cLocalTime;
|
38 | 59 |
|
| 60 | + public Long getcPK() { |
| 61 | + return cPK; |
| 62 | + } |
| 63 | + |
| 64 | + public void setcPK(final Long cPK) { |
| 65 | + this.cPK = cPK; |
| 66 | + } |
| 67 | + |
39 | 68 | public BigDecimal getcBigDecimal() {
|
40 | 69 | return cBigDecimal;
|
41 | 70 | }
|
42 | 71 |
|
43 |
| - public void setcBigDecimal(BigDecimal cBigDecimal) { |
| 72 | + public void setcBigDecimal(final BigDecimal cBigDecimal) { |
44 | 73 | this.cBigDecimal = cBigDecimal;
|
45 | 74 | }
|
46 | 75 |
|
47 | 76 | public LocalDate getcLocalDate() {
|
48 | 77 | return cLocalDate;
|
49 | 78 | }
|
50 | 79 |
|
51 |
| - public void setcLocalDate(LocalDate cLocalDate) { |
| 80 | + public void setcLocalDate(final LocalDate cLocalDate) { |
52 | 81 | this.cLocalDate = cLocalDate;
|
53 | 82 | }
|
54 | 83 |
|
55 | 84 | public LocalDateTime getcLocalDateTime() {
|
56 | 85 | return cLocalDateTime;
|
57 | 86 | }
|
58 | 87 |
|
59 |
| - public void setcLocalDateTime(LocalDateTime cLocalDateTime) { |
| 88 | + public void setcLocalDateTime(final LocalDateTime cLocalDateTime) { |
60 | 89 | this.cLocalDateTime = cLocalDateTime;
|
61 | 90 | }
|
62 | 91 |
|
63 | 92 | public Double getcDouble() {
|
64 | 93 | return cDouble;
|
65 | 94 | }
|
66 | 95 |
|
67 |
| - public void setcDouble(Double cDouble) { |
| 96 | + public void setcDouble(final Double cDouble) { |
68 | 97 | this.cDouble = cDouble;
|
69 | 98 | }
|
70 | 99 |
|
71 | 100 | public Integer getcInteger() {
|
72 | 101 | return cInteger;
|
73 | 102 | }
|
74 | 103 |
|
75 |
| - public void setcInteger(Integer cInteger) { |
| 104 | + public void setcInteger(final Integer cInteger) { |
76 | 105 | this.cInteger = cInteger;
|
77 | 106 | }
|
78 | 107 |
|
79 | 108 | public Long getcLong() {
|
80 | 109 | return cLong;
|
81 | 110 | }
|
82 | 111 |
|
83 |
| - public void setcLong(Long cLong) { |
| 112 | + public void setcLong(final Long cLong) { |
84 | 113 | this.cLong = cLong;
|
85 | 114 | }
|
86 | 115 |
|
87 |
| - public String getcString() { |
88 |
| - return cString; |
| 116 | + public String getcShortString() { |
| 117 | + return cShortString; |
| 118 | + } |
| 119 | + |
| 120 | + public void setcShortString(final String cShortString) { |
| 121 | + this.cShortString = cShortString; |
| 122 | + } |
| 123 | + |
| 124 | + public String getcLongString() { |
| 125 | + return cLongString; |
89 | 126 | }
|
90 | 127 |
|
91 |
| - public void setcString(String cString) { |
92 |
| - this.cString = cString; |
| 128 | + public void setcLongString(final String cLongString) { |
| 129 | + this.cLongString = cLongString; |
93 | 130 | }
|
94 | 131 |
|
95 | 132 | public LocalTime getcLocalTime() {
|
96 | 133 | return cLocalTime;
|
97 | 134 | }
|
98 | 135 |
|
99 |
| - public void setcLocalTime(LocalTime cLocalTime) { |
| 136 | + public void setcLocalTime(final LocalTime cLocalTime) { |
100 | 137 | this.cLocalTime = cLocalTime;
|
101 | 138 | }
|
102 | 139 | }
|
0 commit comments