Skip to content

Commit 967b990

Browse files
committed
Eliminate redundant tests from JsonIoSpecs
1 parent 66e33a7 commit 967b990

File tree

2 files changed

+5
-34
lines changed

2 files changed

+5
-34
lines changed

webauthn-server-attestation/src/test/scala/com/yubico/fido/metadata/JsonIoSpec.scala

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,6 @@ class JsonIoSpec
4747
def test[A](tpe: TypeReference[A])(implicit a: Arbitrary[A]): Unit = {
4848
val cn = tpe.getType.getTypeName
4949
describe(s"${cn}") {
50-
it("can be serialized to JSON.") {
51-
forAll { value: A =>
52-
val encoded: String = json.writeValueAsString(value)
53-
54-
encoded should not be empty
55-
}
56-
}
57-
58-
it("can be deserialized from JSON.") {
59-
forAll { value: A =>
60-
val encoded: String = json.writeValueAsString(value)
61-
val decoded: A = json.readValue(encoded, tpe)
62-
63-
decoded should equal(value)
64-
}
65-
}
66-
6750
it("is identical after multiple serialization round-trips.") {
6851
forAll { value: A =>
6952
val encoded: String = json.writeValueAsString(value)

webauthn-server-core/src/test/scala/com/yubico/webauthn/data/JsonIoSpec.scala

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,32 +61,20 @@ class JsonIoSpec
6161
def test[A](tpe: TypeReference[A])(implicit a: Arbitrary[A]): Unit = {
6262
val cn = tpe.getType.getTypeName
6363
describe(s"${cn}") {
64-
it("can be serialized to JSON.") {
64+
it("is identical after multiple serialization round-trips..") {
6565
forAll { value: A =>
6666
val encoded: String = json.writeValueAsString(value)
6767

68-
encoded should not be empty
69-
}
70-
}
71-
72-
it("can be deserialized from JSON.") {
73-
forAll { value: A =>
74-
val encoded: String = json.writeValueAsString(value)
7568
val decoded: A = json.readValue(encoded, tpe)
76-
7769
decoded should equal(value)
78-
}
79-
}
8070

81-
it("is identical after multiple serialization round-trips..") {
82-
forAll { value: A =>
83-
val encoded: String = json.writeValueAsString(value)
84-
val decoded: A = json.readValue(encoded, tpe)
8571
val recoded: String = json.writeValueAsString(decoded)
86-
87-
decoded should equal(value)
8872
recoded should equal(encoded)
73+
74+
val redecoded: A = json.readValue(recoded, tpe)
75+
redecoded should equal(value)
8976
}
77+
9078
}
9179
}
9280
}

0 commit comments

Comments
 (0)