* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.yangtools.yang.data.impl.codecs;
import static org.junit.Assert.assertEquals;
final QNameModule testModuleQName = QNameModule.create(URI.create("string-pattern-checking-codec-test"));
final Module testModule = schemaContext.findModules("string-pattern-checking-codec-test").iterator().next();
- final ContainerSchemaNode testContainer = (ContainerSchemaNode) testModule.getDataChildByName(
- QName.create(testModuleQName, "test-container"));
- assertNotNull(testContainer);
+ final ContainerSchemaNode testContainer = (ContainerSchemaNode) testModule.findDataChildByName(
+ QName.create(testModuleQName, "test-container")).get();
- final LeafSchemaNode testLeaf = (LeafSchemaNode) testContainer.getDataChildByName(
- QName.create(testModuleQName, "string-leaf-with-valid-pattern"));
- assertNotNull(testLeaf);
+ final LeafSchemaNode testLeaf = (LeafSchemaNode) testContainer.findDataChildByName(
+ QName.create(testModuleQName, "string-leaf-with-valid-pattern")).get();
final StringCodec<String> codec = getCodec(testLeaf.getType(), StringCodec.class);
assertNotNull(codec);
codec.deserialize("abcd");
fail("Exception should have been thrown.");
} catch (final IllegalArgumentException ex) {
- LOG.debug("IllegalArgumentException was thrown as expected: {}", ex);
- assertEquals("Supplied value does not match the regular expression ^[A-Z]+$.", ex.getMessage());
+ LOG.debug("IllegalArgumentException was thrown as expected", ex);
+ assertEquals("Value 'abcd' does not match regular expression '[A-Z]+'", ex.getMessage());
}
}
}