- @Disabled("YT-1473: Instance-identifier values need to be recognized and properly encoded and escaped")
- public void testSerializeInstanceIdentifierValue() throws Exception {
- assertEquals("/bar:bar[.=\"/foo:bar/bar[qname='bar:two'\"]']",
- write(buildYangInstanceIdentifier(BAR_BAR, buildYangInstanceIdentifier(FOO_BAR, FOO_QNAME, BAR_TWO))));
+ @Disabled("YT-1473: bits values need to be recognized and properly encoded and escaped")
+ void testSerializeBitsValue() throws Exception {
+ assertSerdes("/bar:bee[.='']", buildYangInstanceIdentifier(BAR_BEE, ImmutableSet.of()));
+ assertSerdes("/bar:bee[.='one']", buildYangInstanceIdentifier(BAR_BEE, ImmutableSet.of("one")));
+ assertSerdes("/bar:bee[.='two three']", buildYangInstanceIdentifier(BAR_BEE, ImmutableSet.of("two", "three")));
+ }
+
+ private static void assertSerdes(final String expected, final YangInstanceIdentifier id) throws Exception {
+ final var writer = mock(XMLStreamWriter.class);
+ final var captor = ArgumentCaptor.forClass(String.class);
+ CODEC.writeValue(writer, id);
+ verify(writer).writeCharacters(captor.capture());
+ assertEquals(expected, captor.getValue());
+
+ final var context = mock(NamespaceContext.class);
+ doReturn("foons").when(context).getNamespaceURI("foo");
+ doReturn("barns").when(context).getNamespaceURI("bar");
+ assertEquals(id, CODEC.parseValue(context, expected));