void (@NotNull String regExp, int flags, String @NotNull [] matching, String @NotNull [] nonMatching) { LanguageParserDefinitions.INSTANCE.addExplicitExtension(RegExpLanguage.INSTANCE, new RegExpParserDefinition()); // the 1.8 mock jdk has the needed Pattern class Sdk jdk18 = IdeaTestUtil.getMockJdk18(); WriteAction.runAndWait(() -> ProjectJdkTable.getInstance().addJdk(jdk18, myProject)); PsiTestUtil.removeAllRoots(myModule, jdk18); configureByText(JavaFileType.INSTANCE, getJavaText(regExp, flags)); final PsiFile regexpFile = setUpRegexpInjectionAndGetRegexpFile(); for (String text : matching) { assertTrue("Text '" + text + "' should match", CheckRegExpForm.isMatchingTextTest(regexpFile, text)); } for (String text : nonMatching) { assertFalse("Text '" + text + "' should not match", CheckRegExpForm.isMatchingTextTest(regexpFile, text)); } }