String (String in, String what, String by, boolean sourceIsFile, boolean createPhysicalFile) { if (in == null && (sourceIsFile || createPhysicalFile)) { throw new IllegalArgumentException("can't create file when 'in' argument is null"); } final MatchOptions matchOptions = options.getMatchOptions(); if (createPhysicalFile) { configureFromFileText("Source." + matchOptions.getFileType().getDefaultExtension(), in); matchOptions.setScope(new LocalSearchScope(getFile())); } matchOptions.fillSearchCriteria(what); final CompiledPattern compiledPattern = PatternCompiler.compilePattern(getProject(), matchOptions, true, false); final String message = StructuralSearchTestCase.checkApplicableConstraints(matchOptions, compiledPattern); assertNull(message, message); return Replacer.testReplace(in, what, by, options, getProject(), sourceIsFile); }