import static org.mockito.Mockito.verify;
import static org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION;
-import com.google.common.collect.ImmutableList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Iterator;
+import java.util.List;
import java.util.concurrent.ExecutionException;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.with.choice.Foo;
import org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.with.choice.foo.addressable._case.Addressable;
import org.opendaylight.yang.gen.v1.urn.test.opendaylight.mdsal298.rev180129.with.choice.foo.addressable._case.AddressableBuilder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.DataRoot;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.Item;
import org.opendaylight.yangtools.yang.common.QName;
final Container containerAfter = changedContainer.getDataAfter();
assertEquals(new ContainerBuilder()
- .setKeyed(ImmutableList.of(
+ .setKeyed(List.of(
new KeyedBuilder().setFoo("foo").withKey(new KeyedKey("foo")).build(),
new KeyedBuilder().setFoo("bar").withKey(new KeyedKey("bar")).build()))
.build(), containerAfter);
final Iterator<? extends DataObjectModification<?>> it = changedChildren.iterator();
final DataObjectModification<?> changedChild1 = it.next();
assertEquals(ModificationType.WRITE, changedChild1.getModificationType());
- assertEquals(Collections.emptyList(), changedChild1.getModifiedChildren());
+ assertEquals(List.of(), changedChild1.getModifiedChildren());
final Keyed child1After = (Keyed) changedChild1.getDataAfter();
assertEquals("foo", child1After.getFoo());
final DataObjectModification<?> changedChild2 = it.next();
assertEquals(ModificationType.WRITE, changedChild2.getModificationType());
- assertEquals(Collections.emptyList(), changedChild2.getModifiedChildren());
+ assertEquals(List.of(), changedChild2.getModifiedChildren());
final Keyed child2After = (Keyed) changedChild2.getDataAfter();
assertEquals("bar", child2After.getFoo());
}
final Container containerAfter = changedContainer.getDataAfter();
assertEquals(new ContainerBuilder()
- .setUnkeyed(ImmutableList.of(
+ .setUnkeyed(List.of(
new UnkeyedBuilder().setFoo("foo").build(),
new UnkeyedBuilder().setFoo("bar").build()))
.build(), containerAfter);
assertEquals(0, choiceChildren.size());
}
- private <T extends DataObject> DataTreeChangeListener<T> assertWrittenContainer(final QName qname,
+ private <T extends ChildOf<? extends DataRoot>> DataTreeChangeListener<T> assertWrittenContainer(final QName qname,
final Class<T> bindingClass, final T expected)
throws InterruptedException, ExecutionException {
final DataTreeChangeListener<T> listener = mock(DataTreeChangeListener.class);
assertEquals(expected, containerAfter);
// No further modifications should occur
- assertEquals(Collections.emptyList(), changedContainer.getModifiedChildren());
+ assertEquals(List.of(), changedContainer.getModifiedChildren());
reset(listener);
doNothing().when(listener).onDataTreeChanged(any(Collection.class));
assertEquals(new WithChoiceBuilder().build(), containerAfter);
// No further modifications should occur
- assertEquals(Collections.emptyList(), changedContainer.getModifiedChildren());
+ assertEquals(List.of(), changedContainer.getModifiedChildren());
reset(listener);
doNothing().when(listener).onDataTreeChanged(any(Collection.class));