Refactor PathArgument to DataObjectStep
[mdsal.git] / binding / yang-binding / src / test / java / org / opendaylight / yangtools / yang / binding / KeyedInstanceIdentifierTest.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.binding;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertTrue;
12
13 import com.google.common.collect.ImmutableList;
14 import org.junit.Test;
15 import org.opendaylight.yangtools.yang.binding.test.mock.Node;
16 import org.opendaylight.yangtools.yang.binding.test.mock.NodeKey;
17
18 public class KeyedInstanceIdentifierTest {
19     @Test
20     public void basicTest() {
21         final var key = new NodeKey(0);
22         final var keyed = new KeyedInstanceIdentifier<>(new KeyStep<>(Node.class, key), ImmutableList.of(),
23             false, 0);
24
25         assertEquals(key, keyed.getKey());
26         assertTrue(keyed.keyEquals(keyed.builder().build()));
27
28         final var keyless = new InstanceIdentifier<>(Node.class, ImmutableList.of(), true, 0);
29         assertTrue(keyless.keyEquals(keyed.builder().build()));
30     }
31 }