mirror of
https://github.com/pcvolkmer/mv64e-onkostar-data.git
synced 2025-07-03 02:52:54 +00:00
test: add tests for boolean values
This commit is contained in:
@ -2,11 +2,13 @@ package dev.pcvolkmer.onco.datamapper;
|
|||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
class ResultSetTest {
|
class ResultSetTest {
|
||||||
|
|
||||||
@ -40,12 +42,22 @@ class ResultSetTest {
|
|||||||
assertThat(data.getDate("date")).isEqualTo(new Date(Date.from(Instant.parse("2025-06-21T00:00:00Z")).getTime()));
|
assertThat(data.getDate("date")).isEqualTo(new Date(Date.from(Instant.parse("2025-06-21T00:00:00Z")).getTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldHandleBooleanValues() {
|
||||||
|
var data = getTestData();
|
||||||
|
|
||||||
|
assertTrue(data.isTrue("true"));
|
||||||
|
assertFalse(data.isTrue("false"));
|
||||||
|
}
|
||||||
|
|
||||||
static ResultSet getTestData() {
|
static ResultSet getTestData() {
|
||||||
return ResultSet.from(
|
return ResultSet.from(
|
||||||
Map.of(
|
Map.of(
|
||||||
"string", "TestString",
|
"string", "TestString",
|
||||||
"int", 42,
|
"int", 42,
|
||||||
"date", new Date(Date.from(Instant.parse("2025-06-21T02:00:00Z")).getTime())
|
"date", new Date(Date.from(Instant.parse("2025-06-21T02:00:00Z")).getTime()),
|
||||||
|
"true", 1,
|
||||||
|
"false", 0
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user