2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.mdsal.binding.dom.adapter;
10 import static org.junit.Assert.assertEquals;
11 import static org.mockito.ArgumentMatchers.any;
12 import static org.mockito.Mockito.doReturn;
13 import static org.mockito.Mockito.mock;
15 import org.junit.Test;
16 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
17 import org.opendaylight.mdsal.dom.api.DOMNotification;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsal.test.binding.rev140701.TwoLevelListChangedBuilder;
19 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
21 public class LazySerializedDOMNotificationTest {
24 public void basicTest() throws Exception {
25 BindingNormalizedNodeSerializer codec = mock(BindingNormalizedNodeSerializer.class);
26 final DOMNotification lazySerializedDOMNotification =
27 new LazySerializedNotification(codec, new TwoLevelListChangedBuilder().build());
28 ContainerNode containerNode = mock(ContainerNode.class);
29 doReturn(containerNode).when(codec).toNormalizedNodeNotification(any());
30 assertEquals(containerNode, lazySerializedDOMNotification.getBody());