1 package org.onap.ccsdk.cds.blueprintsprocessor.uat.utils
3 import org.mockito.ArgumentMatcher
4 import org.skyscreamer.jsonassert.JSONAssert
5 import org.skyscreamer.jsonassert.JSONCompareMode
7 class JsonMatcher(val expectedJson: String?) : ArgumentMatcher<String> {
9 override fun matches(actualJson: String?): Boolean {
10 if (expectedJson == null) {
11 return actualJson == null
12 } else if (actualJson.isNullOrEmpty() && (expectedJson.isEmpty() || expectedJson.equals("null"))) {
13 // null, "" and "null" means the same here
15 } else if (!actualJson.isNullOrEmpty() && expectedJson.isNotEmpty()) {
17 JSONAssert.assertEquals("", expectedJson, actualJson, JSONCompareMode.LENIENT)
19 } catch (e: AssertionError) {