void (String text) { doParserTest(text, builder -> { PatternParser parser = JavaParser.INSTANCE.getPatternParser(); if (!parser.isPattern(builder)) { throw new IllegalArgumentException("Pattern is not expected"); } parser.parsePattern(builder); }); }