From 2692aa77bdb2ec2fe23b2e6704b047c6ccfdb0da Mon Sep 17 00:00:00 2001 From: Ian Tabolt Date: Fri, 6 Oct 2017 13:50:26 -0400 Subject: [PATCH] Add test case for serializing ValidationFailed --- .../com/typesafe/config/impl/ValidationTest.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/config/src/test/scala/com/typesafe/config/impl/ValidationTest.scala b/config/src/test/scala/com/typesafe/config/impl/ValidationTest.scala index 6dce7bfee..5e45aad61 100644 --- a/config/src/test/scala/com/typesafe/config/impl/ValidationTest.scala +++ b/config/src/test/scala/com/typesafe/config/impl/ValidationTest.scala @@ -97,6 +97,21 @@ class ValidationTest extends TestUtils { checkValidationException(e, expecteds) } + @Test + def validationFailedSerializable(): Unit = { + // Reusing a previous test case to generate an error + val reference = parseConfig("""{ a : [{},{},{}] }""") + val conf = parseConfig("""{ a : 42 }""") + val e = intercept[ConfigException.ValidationFailed] { + conf.checkValid(reference) + } + + val expecteds = Seq(WrongType("a", 1, "list", "number")) + + val actual = checkSerializableNoMeaningfulEquals(e) + checkValidationException(actual, expecteds) + } + @Test def validationAllowsListOverriddenWithSameTypeList() { val reference = parseConfig("""{ a : [1,2,3] }""")