package org.opendaylight.restconf.nb.rfc8040.databind;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertThrows;
import java.util.Map;
import org.junit.jupiter.api.Test;
@Test
void testMissingKeys() {
- final var ex = assertThrows(IllegalArgumentException.class,
- () -> parse("nested-module:depth1-cont/depth2-list2=one,two", """
+ final var error = assertError(() -> parse("nested-module:depth1-cont/depth2-list2=one,two", """
{
"depth2-list2" : {
"depth3-lf1-key" : "one"
}
}"""));
- assertNull(ex.getMessage());
+ assertEquals("""
+ Error parsing input: List entry (urn:nested:module?revision=2014-06-03)depth2-list2 is missing leaf values \
+ for [depth3-lf2-key]""", error.getErrorMessage());
+ assertEquals(ErrorType.PROTOCOL, error.getErrorType());
+ assertEquals(ErrorTag.MALFORMED_MESSAGE, error.getErrorTag());
}
@Test