RouteModel implements Serializable { String formatTemplate(String template, Set<RouteParameterFormatOption> format) { if (format.contains(RouteParameterFormatOption.NAME) && format.contains(RouteParameterFormatOption.MODIFIER) && format.contains(RouteParameterFormatOption.REGEX)) { return template; } return root.formatTemplate(template, segment -> RouteFormat.formatSegment(segment, format)); } private  RouteModel(boolean mutable); private  RouteModel(RouteSegment root, boolean mutable);   }
@Test public void route_model_provides_url_template_format() { RouteModel root = getRouteModel(); final String template = "trunk/branch/:id(" + RouteParameterRegex.INTEGER + ")/:list*(" + RouteParameterRegex.LONG + ")"; Assert.assertEquals(template, root.formatTemplate(template, EnumSet.of(RouteParameterFormatOption.NAME, RouteParameterFormatOption.REGEX, RouteParameterFormatOption.MODIFIER))); Assert.assertEquals("trunk/branch/:id(integer)/:list*(long)", root.formatTemplate(template, EnumSet.of(RouteParameterFormatOption.NAME, RouteParameterFormatOption.REGEX_NAME, RouteParameterFormatOption.MODIFIER))); Assert.assertEquals("trunk/branch/:id(integer)/:list(long)", root.formatTemplate(template, EnumSet.of(RouteParameterFormatOption.NAME, RouteParameterFormatOption.REGEX_NAME))); Assert.assertEquals("trunk/branch/:id/:list*", root.formatTemplate(template, EnumSet.of(RouteParameterFormatOption.NAME, RouteParameterFormatOption.MODIFIER))); Assert.assertEquals("trunk/branch/:integer/:long", root.formatTemplate(template, EnumSet.of(RouteParameterFormatOption.REGEX_NAME))); }