I have a method that does comparison of two jsons.
import org.json.JSONException;
import org.junit.Test;
import org.skyscreamer.jsonassert.*;
import org.skyscreamer.jsonassert.comparator.CustomComparator;
public class TestClass {
@Test
public void jsonCompareTest() throws JSONException {
JSONAssert.assertEquals("{x: 1, time:123}", "{x: 1, time:234}",
new CustomComparator(
JSONCompareMode.LENIENT,
Customization.customization("time",
(ValueMatcher)(o1, o2) -> true)));
}
}
So it works as expected, no issues. However, the following section is highlighted in yellow!
(ValueMatcher)(o1, o2) -> true
It gives following warning:
Unchecked assignment: 'org.skyscreamer.jsonassert.ValueMatcher' to 'org.skyscreamer.jsonassert.ValueMatcher<java.lang.Object>'
Signals places where an unchecked warning is issued by the compiler, for example:
void f(HashMap map) {
map.put("key", "value");
}
If I put the following above the class, it disappears:
@SuppressWarnings("unchecked")
But is there any other way to properly fix it rather than suppress the warning?!
Please give example in the current context