Remove unneeded Java 9+ check
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / test / java / org / opendaylight / controller / cluster / datastore / node / utils / QNameFactoryTest.java
1 /*
2  * Copyright (c) 2014, 2015 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.controller.cluster.datastore.node.utils;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotSame;
12 import static org.junit.Assert.assertSame;
13
14 import org.junit.Test;
15 import org.opendaylight.controller.cluster.datastore.util.TestModel;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.common.Revision;
18
19 public class QNameFactoryTest {
20
21     @Test
22     @Deprecated
23     public void testBasicString() {
24         QName expected = TestModel.AUG_NAME_QNAME;
25         QName created = QNameFactory.create(expected.toString());
26         assertNotSame(expected, created);
27         assertEquals(expected, created);
28
29         QName cached = QNameFactory.create(expected.toString());
30         assertSame(created, cached);
31     }
32
33     @Test
34     public void testBasic() {
35         QName expected = TestModel.AUG_NAME_QNAME;
36         QName created = lookup(expected);
37         assertNotSame(expected, created);
38         assertEquals(expected, created);
39
40         QName cached = lookup(expected);
41         assertSame(created, cached);
42     }
43
44     private static QName lookup(final QName qname) {
45         return QNameFactory.create(qname.getLocalName(), qname.getNamespace().toString(),
46             qname.getRevision().map(Revision::toString).orElse(null));
47     }
48 }