RegExUtil { static public Pattern compile(String regex, PMMLObject context){ return compile(regex, 0, context); } private  RegExUtil(); static Pattern compile(String regex, PMMLObject context); static Pattern compile(String regex, int flags, PMMLObject context);  }
@Test public void compile(){ String regex = "["; try { RegExUtil.compile(regex, null); fail(); } catch(EvaluationException ee){ Throwable cause = ee.getCause(); assertEquals(null, ee.getContext()); assertTrue(cause instanceof PatternSyntaxException); } TextIndex textIndex = new TextIndex(); try { RegExUtil.compile("[", textIndex); fail(); } catch(EvaluationException ee){ Throwable cause = ee.getCause(); assertEquals(textIndex, ee.getContext()); assertTrue(cause instanceof PatternSyntaxException); } }