2 * Copyright (c) 2013 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.config.yangjmxgenerator;
10 import static org.junit.Assert.assertEquals;
11 import static org.mockito.Mockito.doReturn;
12 import static org.mockito.Mockito.mock;
17 import org.junit.Test;
18 import org.opendaylight.yangtools.yang.model.api.Module;
20 import com.google.common.collect.Maps;
22 public class PackageTranslatorTest {
23 public static final String EXPECTED_PACKAGE_PREFIX = "org.opendaylight.controller.config";
26 public void test() throws Exception {
27 Map<String, String> map = Maps.newHashMap();
28 map.put(ConfigConstants.CONFIG_NAMESPACE, EXPECTED_PACKAGE_PREFIX);
29 PackageTranslator tested = new PackageTranslator(map);
30 Module module = mock(Module.class);
31 doReturn(new URI(ConfigConstants.CONFIG_NAMESPACE + ":threads:api"))
32 .when(module).getNamespace();
33 assertEquals(EXPECTED_PACKAGE_PREFIX + ".threads.api",
34 tested.getPackageName(module));