import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
-import java.io.FileNotFoundException;
import java.net.URI;
-import java.net.URISyntaxException;
import org.junit.Test;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private static final Logger LOG = LoggerFactory.getLogger(StringPatternCheckingCodecTest.class);
@Test
- public void testStringPatternCheckingCodec() throws ReactorException, URISyntaxException,
- FileNotFoundException {
+ public void testStringPatternCheckingCodec() {
final SchemaContext schemaContext = YangParserTestUtils.parseYangResource(
"/string-pattern-checking-codec-test.yang");
assertNotNull(schemaContext);
codec.deserialize("abcd");
fail("Exception should have been thrown.");
} catch (final IllegalArgumentException ex) {
- LOG.debug("IllegalArgumentException was thrown as expected: {}", ex);
- assertTrue(ex.getMessage().contains(
- "Supplied value does not match the regular expression ^[A-Z]+$. [abcd]"));
+ LOG.debug("IllegalArgumentException was thrown as expected", ex);
+ assertEquals("Supplied value does not match the regular expression ^(?:[A-Z]+)$.", ex.getMessage());
}
}
}