private void checkForParseError(String stream, XDDSLMessages msg, int pos, Object... inserts) {
		try {
			StreamNode sn = parse(stream);
			fail("expected to fail but parsed " + sn.stringify());
		}
		catch (StreamDefinitionException e) {
			assertEquals(msg, e.getMessageCode());
			assertEquals(pos, e.getPosition());
			if (inserts != null) {
				for (int i = 0; i < inserts.length; i++) {
					assertEquals(inserts[i], e.getInserts()[i]);
				}
			}
		}
	}
Parse streams and verify either the correct abstract syntax tree is produced or the current exception comes out.

@author Andy Clement
@author David Turanski
spring-xd-dirt/src/test/java/org/springframework/xd/dirt/stream/dsl/StreamConfigParserTests.java