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.yangtools.yang.binding;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertTrue;
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;
18 public class KeyedInstanceIdentifierTest {
20 public void basicTest() {
21 final var key = new NodeKey(0);
22 final var keyed = new KeyedInstanceIdentifier<>(new KeyStep<>(Node.class, key), ImmutableList.of(),
25 assertEquals(key, keyed.getKey());
26 assertTrue(keyed.keyEquals(keyed.builder().build()));
28 final var keyless = new InstanceIdentifier<>(Node.class, ImmutableList.of(), true, 0);
29 assertTrue(keyless.keyEquals(keyed.builder().build()));