### Question:
JCTreeUtils { public String getRepeatPart(String messagePattern) { Pattern p = Pattern.compile(REPEAT_PATTERN); Matcher m = p.matcher(messagePattern); if (m.find()) { String found = m.group(); return found.substring(1, found.length() - 1); } return ""; }  String getRepeatPart(String messagePattern); boolean hasBody(final JCTree element); @SneakyThrows JCTree.JCStatement getBody(final JCTree element); com.sun.tools.javac.util.List<JCTree.JCStatement> generateNewBody(JCTree parentheses, JCTree.JCStatement block, JCTree.JCStatement methodCall); String message(String[] valueFromAnn, ConfigurationKey<String> key, ClassContext context); static final String REPEAT_PATTERN; static final VoidAnnotation VOID_ANN; }### Answer:
@Test public void testGetRepeatPart() throws Exception { final String m1 = "some message [x]"; String r1 = JCTreeUtils.getRepeatPart(m1); Assertions.assertEquals("x", r1); final String m2 = "just message"; String r2 = JCTreeUtils.getRepeatPart(m2); Assertions.assertEquals("", r2); }