Skip to content

Commit 90aa1c3

Browse files
committed
Fix MSSQLPreparedQueryNotNullableDataTypeTest#testEncodeSmallDateTime
Closes #1086 Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
1 parent ce0b521 commit 90aa1c3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

vertx-mssql-client/src/test/java/io/vertx/mssqlclient/data/MSSQLPreparedQueryNotNullableDataTypeTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,9 @@ public void testEncodeTime(TestContext ctx) {
138138
public void testEncodeSmallDateTime(TestContext ctx) {
139139
LocalDateTime now = LocalDateTime.now();
140140
// Seconds are rounded to the nearest minute
141-
int roundedUpMinute = (int) Math.floor(now.getSecond()/30.0);
142-
LocalDateTime convertedNow = now.withSecond(0).withNano(0).withMinute(now.getMinute() + roundedUpMinute);
141+
int roundedUpMinute = now.getSecond() < 30 ? 0 : 1;
142+
int plusMinutes = now.getMinute() + roundedUpMinute;
143+
LocalDateTime convertedNow = now.withSecond(0).withNano(0).withMinute(0).plusMinutes(plusMinutes);
143144
testPreparedQueryEncodeGeneric(ctx, "not_nullable_datatype", "test_smalldatetime", now, row -> {
144145
ColumnChecker.checkColumn(0, "test_smalldatetime")
145146
.returns(Tuple::getValue, Row::getValue, convertedNow)

0 commit comments

Comments
 (0)