ce5b7440dd3549e94db91cecf75e7c30461abb03
[yangtools.git] / data / yang-data-api / src / test / java / org / opendaylight / yangtools / yang / data / api / schema / DuplicityTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.data.api.schema;
9
10 import static org.junit.jupiter.api.Assertions.assertEquals;
11 import static org.mockito.Mockito.doReturn;
12
13 import java.util.List;
14 import java.util.Map;
15 import org.junit.jupiter.api.Test;
16 import org.junit.jupiter.api.extension.ExtendWith;
17 import org.mockito.Mock;
18 import org.mockito.junit.jupiter.MockitoExtension;
19
20 @ExtendWith(MockitoExtension.class)
21 // FIXME: This is a sorry-ass of a test. Move the method, DuplicateFinder and this test to yang-data-util and expand
22 //        coverage using ImmutableNodes.
23 class DuplicityTest {
24     @Mock
25     private LeafNode<?> leaf;
26     @Mock
27     private ContainerNode container;
28
29     @Test
30     public void testDuplicateLeaf() {
31         assertEquals(Map.of(), NormalizedNodes.findDuplicates(leaf));
32     }
33
34     @Test
35     public void testDuplicateContainer() {
36         doReturn(List.of()).when(container).body();
37         assertEquals(Map.of(), NormalizedNodes.findDuplicates(container));
38     }
39 }