File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
src/test/scala/scalapb/json4s Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,24 @@ class AnyFormatSpec extends AnyFlatSpec with Matchers with JavaAssertions {
120
120
ScalaJsonPrinter .toJson(input) must be(optionalAnyJson)
121
121
}
122
122
123
+ " Any" should " serialize a timestamp value" in {
124
+ val optionalAnyJson = parse(""" {
125
+ "optionalAny": {
126
+ "@type": "type.googleapis.com/google.protobuf.Timestamp",
127
+ "value": "1970-01-01T00:00:00Z"
128
+ }
129
+ }""" )
130
+
131
+ val input = ScalaJsonParser .fromJson[AnyContainer ](optionalAnyJson)
132
+
133
+ input.getOptionalAny
134
+ .unpack[com.google.protobuf.timestamp.Timestamp ] must be(
135
+ com.google.protobuf.timestamp.Timestamp ()
136
+ )
137
+
138
+ ScalaJsonPrinter .toJson(input) must be(optionalAnyJson)
139
+ }
140
+
123
141
" Any" should " work when nested" in {
124
142
val nestedAny = parse(""" {
125
143
| "optionalAny": {
You can’t perform that action at this time.
0 commit comments