*/
package org.opendaylight.controller.sal.restconf.impl.test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertNotNull;
import java.net.URI;
import java.net.URISyntaxException;
import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper;
-import org.opendaylight.controller.sal.restconf.impl.ResponseException;
+import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
dataLoad("/normalize-node/yang/");
}
- @Test
+ @Test(expected=RestconfDocumentedException.class)
public void namespaceNotNullAndInvalidNamespaceAndNoModuleNameTest() {
- boolean exceptionReised = false;
- try {
- TestUtils.normalizeCompositeNode(prepareCnSn("wrongnamespace"), modules, schemaNodePath);
- } catch (ResponseException e) {
- exceptionReised = true;
- }
- assertTrue(exceptionReised);
+
+ TestUtils.normalizeCompositeNode(prepareCnSn("wrongnamespace"), modules, schemaNodePath);
}
@Test
public void namespaceNullTest() {
- String exceptionMessage = null;
- try {
- TestUtils.normalizeCompositeNode(prepareCnSn(null), modules, schemaNodePath);
- } catch (ResponseException e) {
- exceptionMessage = String.valueOf(e.getResponse().getEntity());
- }
- assertNull(exceptionMessage);
+
+ TestUtils.normalizeCompositeNode(prepareCnSn(null), modules, schemaNodePath);
}
@Test
public void namespaceValidNamespaceTest() {
- String exceptionMessage = null;
- try {
- TestUtils.normalizeCompositeNode(prepareCnSn("normalize:node:module"), modules, schemaNodePath);
- } catch (ResponseException e) {
- exceptionMessage = String.valueOf(e.getResponse().getEntity());
- }
- assertNull(exceptionMessage);
+
+ TestUtils.normalizeCompositeNode(prepareCnSn("normalize:node:module"), modules, schemaNodePath);
}
@Test
public void namespaceValidModuleNameTest() {
- String exceptionMessage = null;
- try {
- TestUtils.normalizeCompositeNode(prepareCnSn("normalize-node-module"), modules, schemaNodePath);
- } catch (ResponseException e) {
- exceptionMessage = String.valueOf(e.getResponse().getEntity());
- }
- assertNull(exceptionMessage);
+
+ TestUtils.normalizeCompositeNode(prepareCnSn("normalize-node-module"), modules, schemaNodePath);
}
- private CompositeNode prepareCnSn(String namespace) {
+ private CompositeNode prepareCnSn(final String namespace) {
URI uri = null;
if (namespace != null) {
try {