package jetbrains.mps.lang.test.runtime; /*Generated by MPS */ import org.jetbrains.mps.openapi.model.SNode; import junit.framework.Assert; import jetbrains.mps.lang.test.matcher.NodesMatcher; import jetbrains.mps.errors.IErrorReporter; import org.jetbrains.mps.openapi.module.SRepository; public class NodeCheckerUtil { public static String nodeWithIdToString(final SNode node) { return node + " [" + node.getNodeId() + "]"; } public static void assertTypesAreTheSame(SNode node, final SNode type1, final SNode type2) { String errorString = "node '" + nodeWithIdToString(node) + "' does not have type '" + nodeWithIdToString(type2) + "'!"; Assert.assertNull(errorString, NodesMatcher.matchNodes(type1, type2)); } public static SNode getRuleNodeFromReporter(IErrorReporter reporter, SRepository contextRepository) { if (reporter.getRuleNode() == null || contextRepository == null) { return null; } return reporter.getRuleNode().resolve(contextRepository); } public static void checkNodeForErrorMessages(final SNode node, final boolean allowErrors, final boolean allowWarnings, boolean includeSelf) { Runnable checkErrorsAction = new CheckErrorMessagesAction(node, allowWarnings, allowErrors).includeSelf(includeSelf); checkErrorsAction.run(); } }