forked from sksamuel/avro4s
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LocalDateTime with nanosecond precision fixed sksamuel#375
- Loading branch information
Showing
9 changed files
with
114 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
avro4s-core/src/test/scala/com/sksamuel/avro4s/record/LocalDateTimeRoundTrip.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.sksamuel.avro4s.record | ||
|
||
import java.time.LocalDateTime | ||
|
||
import com.sksamuel.avro4s.{AvroSchema, Decoder, DefaultFieldMapper, Encoder} | ||
import org.scalatest.{FunSuite, Matchers} | ||
|
||
class LocalDateTimeRoundTrip extends FunSuite with Matchers { | ||
|
||
test("local date time round trip") { | ||
|
||
val localDateTime = LocalDateTime.of(2018, 1, 1, 23, 30, 5, 328187943) | ||
|
||
val encodedLocalDateTime = Encoder[LocalDateTime].encode( | ||
localDateTime, | ||
AvroSchema[LocalDateTime], | ||
DefaultFieldMapper | ||
) | ||
|
||
Decoder[LocalDateTime] | ||
.decode(encodedLocalDateTime, AvroSchema[LocalDateTime], DefaultFieldMapper) shouldEqual localDateTime | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters