Skip to content

Commit

Permalink
Adding testValidator_inner_size
Browse files Browse the repository at this point in the history
  • Loading branch information
michaellifTelus committed Oct 22, 2022
1 parent d0a13b3 commit 88002f4
Showing 1 changed file with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,35 @@ class JsonPathValidatorTest {
"array3": []
}
""".trimIndent(), listOf(
ValidationRule("$.array1", OpType.Size, 3),
ValidationRule("$.array2", OpType.Size, 2),
ValidationRule("$.array3", OpType.Size, 0)
ValidationRule("$.array1[*]", OpType.Size, 3),
ValidationRule("$.array2[*]", OpType.Size, 2),
ValidationRule("$.array3[*]", OpType.Size, 0)
)
)
}

@Test
@Suppress("FunctionNaming")
fun testValidator_inner_size() {
JsonPathValidator.assertJson(
"""
{
"parent": [
{
"name": "name1",
"array1": ["123", "234", "345"],
"array2": ["123", "123"],
"array3": []
}
]
}
""".trimIndent(), listOf(
ValidationRule("$.parent[?(@.name == \"name1\")].array1[*]", OpType.Size, 3),
ValidationRule("$.parent[?(@.name == \"name1\")].array2[*]", OpType.Size, 2),
ValidationRule("$.parent[?(@.name == \"name1\")].array3[*]", OpType.Size, 0)
)
)
}


}

0 comments on commit 88002f4

Please sign in to comment.