2 * Copyright (c) 2014 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.data.impl.codec.xml;
10 import org.junit.Assert;
11 import org.junit.Before;
12 import org.junit.Test;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.data.impl.codec.xml.RandomPrefix;
19 public class RandomPrefixTest {
20 private RandomPrefix randomPrefix;
23 * setup {@link #randomPrefix} instance
27 randomPrefix = new RandomPrefix();
30 * Test method for {@link org.opendaylight.yangtools.yang.data.impl.codec.xml.RandomPrefix#encodeQName(QName)}.
33 public void testEncodeQName() {
34 QName node = QName.create("","2013-06-07","node");
35 String encodedQName = randomPrefix.encodeQName(node);
36 Assert.assertNotNull(encodedQName);
37 Assert.assertTrue("prefix is expected to contain 4 small letters as prefix but result is: "+encodedQName,
38 encodedQName.matches("[a-z]{4}:node"));