Skip to content

Commit 0c8ad07

Browse files
committed
Additional tests for WrappedJson
1 parent c8ec804 commit 0c8ad07

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

core/src/test/scala/com/avsystem/commons/serialization/json/JsonStringInputOutputTest.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ class JsonStringInputOutputTest extends AnyFunSuite with SerializationTestUtils
6060
assert(resBuilder.result() == jsons)
6161
}
6262

63-
test("WrappedJson") {
64-
val json = """{"a": 123, "b": 3.14}"""
65-
assert(JsonStringOutput.write(WrappedJson(json)) == json)
66-
assert(JsonStringInput.read[WrappedJson](json) == WrappedJson(json))
67-
}
68-
6963
def roundtrip[T: GenCodec](name: String)(values: T*)(implicit pos: Position): Unit = {
7064
test(name) {
7165
val serialized = values.map(write[T](_))
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.avsystem.commons
2+
package serialization.json
3+
4+
import com.avsystem.commons.serialization.{SimpleValueInput, SimpleValueOutput}
5+
import org.scalatest.funsuite.AnyFunSuite
6+
import org.scalatest.matchers.should.Matchers
7+
8+
class WrappedJsonTest extends AnyFunSuite with Matchers {
9+
10+
private val testJson = """{"a": 123, "b": 3.14}"""
11+
12+
test("WrappedJson with JSON input/output") {
13+
assert(JsonStringOutput.write(WrappedJson(testJson)) == testJson)
14+
assert(JsonStringInput.read[WrappedJson](testJson) == WrappedJson(testJson))
15+
}
16+
17+
// SimpleValueInput/Output does not support RawJson marker
18+
test("WrappedJson with plain input/output") {
19+
assert(SimpleValueOutput.write(WrappedJson(testJson)) == testJson)
20+
assert(SimpleValueInput.read[WrappedJson](testJson) == WrappedJson(testJson))
21+
}
22+
}

0 commit comments

Comments
 (0)