466b168a00c8c84dc8f9ba5480c1ca90db4483ad
[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.assertFalse;
12 import static org.junit.Assert.assertTrue;
13 import static org.mockito.Mockito.mock;
14
15 import com.google.common.collect.ImmutableList;
16 import org.junit.Test;
17
18 public class KeyedInstanceIdentifierTest {
19
20     @Test
21     public void basicTest() {
22         final Key<?> key = mock(Key.class);
23         final KeyedInstanceIdentifier<?, ?> keyedInstanceIdentifier =
24                 new KeyedInstanceIdentifier(KeyAware.class, ImmutableList.of(), false, 0, key);
25
26         assertEquals(key, keyedInstanceIdentifier.getKey());
27
28         assertFalse(keyedInstanceIdentifier.fastNonEqual(keyedInstanceIdentifier.builder().build()));
29         assertTrue(new KeyedInstanceIdentifier(KeyAware.class, ImmutableList.of(), false, 0, null)
30                 .fastNonEqual(keyedInstanceIdentifier.builder().build()));
31     }
32 }