Skip to content

Commit

Permalink
Fix for Java11
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko committed Aug 30, 2019
1 parent 84b3afb commit 782d76c
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,22 @@
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;

import static org.junit.Assert.assertEquals;

public class TestSpecificToFromByteArray {

@Test
public void testSpecificToFromByteBufferWithLogicalTypes() throws IOException {
// Java 9+ comes with NANO precision and since we encode it using millis
// precision
// Therefore we won't want to have NANOs in the input
LocalTime t = LocalTime.now().truncatedTo(ChronoUnit.NANOS);
Instant instant = Instant.now().truncatedTo(ChronoUnit.NANOS);

final TestRecordWithLogicalTypes record = new TestRecordWithLogicalTypes(true, 34, 35L, 3.14F, 3019.34, null,
LocalDate.now(), LocalTime.now(), Instant.now(), new BigDecimal("123.45"));
LocalDate.now(), t, instant, new BigDecimal("123.45"));

final ByteBuffer b = record.toByteBuffer();
final TestRecordWithLogicalTypes copy = TestRecordWithLogicalTypes.fromByteBuffer(b);
Expand Down

0 comments on commit 782d76c

Please sign in to comment.