ResourceLinkGenerator { protected String queryTemplateFrom(final Method method) { final StringBuilder sb = new StringBuilder(); final List<ParameterInfo> parameterInfos = getParameterInfos(method); boolean first = true; for (final ParameterInfo parameterInfo : parameterInfos) { if (hrefVarsGenerator.hasRequestParam(parameterInfo)) { if (first) { first = false; sb.append("{?").append(parameterInfo.getName()); } else { sb.append(",").append(parameterInfo.getName()); } } } final String s = sb.toString(); return s.isEmpty() ? s : s + "}"; } protected  ResourceLinkGenerator(final URI applicationBaseUri,
                                    final URI relationTypeBaseUri,
                                    final URI varTypeBaseUri,
                                    final HintsGenerator hintsGenerator,
                                    final HrefVarsGenerator hrefVarsGenerator); ResourceLink resourceLinkFor(final Method method);  }
@Test public void queryTemplateForNoParam() throws Exception { ResourceLinkGenerator generator = new TestResourceLinkGenerator(); final String query = generator.queryTemplateFrom(TestController.class.getMethod("directLink")); assertEquals(query, ""); }
@Test public void queryTemplateForSingleParam() throws Exception { ResourceLinkGenerator generator = new TestResourceLinkGenerator(); final String query = generator.queryTemplateFrom(TestController.class.getMethod("templatedLink", String.class)); assertEquals(query, "{?bar}"); }
@Test public void queryTemplateForDoubleParam() throws Exception { ResourceLinkGenerator generator = new TestResourceLinkGenerator(); final String query = generator.queryTemplateFrom(TestController.class.getMethod("templatedLink", String.class, String.class)); assertEquals(query, "{?bar,foobar}"); }