2 * Copyright (c) 2014, 2015 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.controller.cluster.datastore.node.utils;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotSame;
12 import static org.junit.Assert.assertSame;
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;
19 @Deprecated(forRemoval = true)
20 public class QNameFactoryTest {
24 public void testBasicString() {
25 QName expected = TestModel.AUG_NAME_QNAME;
26 QName created = QNameFactory.create(expected.toString());
27 assertNotSame(expected, created);
28 assertEquals(expected, created);
30 QName cached = QNameFactory.create(expected.toString());
31 assertSame(created, cached);
35 public void testBasic() {
36 QName expected = TestModel.AUG_NAME_QNAME;
37 QName created = lookup(expected);
38 assertNotSame(expected, created);
39 assertEquals(expected, created);
41 QName cached = lookup(expected);
42 assertSame(created, cached);
45 private static QName lookup(final QName qname) {
46 return QNameFactory.create(qname.getLocalName(), qname.getNamespace().toString(),
47 qname.getRevision().map(Revision::toString).orElse(null));