Skip to content

Commit 8533c61

Browse files
fblundunalexanderdean
authored andcommitted
Added exceptions to make match statements exhaustive
1 parent a23df62 commit 8533c61

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

java-scala/src/test/scala/com/snowplowanalytics/refererparser/scala/JsonParseTest.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class JsonParseTest extends Specification {
3333
// Convert the JSON to a List of JObjects
3434
val testJson = (parse(testString)) match {
3535
case JArray(lst) => lst
36+
case _ => throw new Exception("referer-tests.json is not an array - this should never happen")
3637
}
3738

3839
val pageHost = "www.snowplowanalytics.com"
@@ -42,6 +43,7 @@ class JsonParseTest extends Specification {
4243
def getString(node: JValue, name: String): String =
4344
(node \ name) match {
4445
case JString(s) => s
46+
case _ => throw new Exception("The value of field '%s' in referer-tests.json is not a string - this should never happen".format(name))
4547
}
4648

4749
"parse" should {

0 commit comments

Comments
 (0)