* 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.stmt;
-import static org.junit.Assert.assertTrue;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.startsWith;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;
import java.io.File;
import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
public class Bug7954Test {
-
@Test
public void testParsingTheSameModuleTwice() throws Exception {
final File yang = new File(getClass().getResource("/bugs/bug7954/foo.yang").toURI());
fail("An exception should have been thrown because of adding the same YANG module twice.");
} catch (final ReactorException ex) {
final Throwable cause = ex.getCause();
- assertTrue(cause instanceof SourceException);
- assertTrue(cause.getMessage().startsWith("Module namespace collision: foo-ns."));
+ assertThat(cause, instanceOf(SourceException.class));
+ assertThat(cause.getMessage(), startsWith("Module namespace collision: foo-ns."));
}
}
fail("An exception should have been thrown because of adding the same YANG submodule twice.");
} catch (final ReactorException ex) {
final Throwable cause = ex.getCause();
- assertTrue(cause instanceof SourceException);
- assertTrue(cause.getMessage().startsWith("Submodule name collision: subbar."));
+ assertThat(cause, instanceOf(SourceException.class));
+ assertThat(cause.getMessage(), startsWith("Submodule name collision: subbar."));
}
}
}