@Test public void validEncodedDataTest() { final String rootLink = "www.some-link.net&"; JiraLinkGenerator jiraLink = new JiraLinkGenerator(rootLink); String expectedString = rootLink + "summary=Summary&description=Description&reporter=Toto"; String generatedLink = jiraLink.generateLink("Summary", "Description", "Toto"); assertEquals(expectedString,generatedLink); }
public String generateLink(final String issueSummary, final String issueDescription, final String issueReporter) { final Map<String, Object> map = new LinkedHashMap<String, Object>(); map.put("summary", issueSummary); map.put("description", issueDescription); map.put("reporter", issueReporter); final StringBuilder sb = new StringBuilder(); for (final Map.Entry<?, ?> entry : map.entrySet()) { if (sb.length() > 0) { sb.append("&"); } sb.append(String.format("%s=%s", urlEncodeUTF8(entry.getKey() .toString()), urlEncodeUTF8(entry.getValue().toString()))); } return String.format("%s%s", rootLink,sb.toString()); }
JiraLinkGenerator { public String generateLink(final String issueSummary, final String issueDescription, final String issueReporter) { final Map<String, Object> map = new LinkedHashMap<String, Object>(); map.put("summary", issueSummary); map.put("description", issueDescription); map.put("reporter", issueReporter); final StringBuilder sb = new StringBuilder(); for (final Map.Entry<?, ?> entry : map.entrySet()) { if (sb.length() > 0) { sb.append("&"); } sb.append(String.format("%s=%s", urlEncodeUTF8(entry.getKey() .toString()), urlEncodeUTF8(entry.getValue().toString()))); } return String.format("%s%s", rootLink,sb.toString()); } }
JiraLinkGenerator { public String generateLink(final String issueSummary, final String issueDescription, final String issueReporter) { final Map<String, Object> map = new LinkedHashMap<String, Object>(); map.put("summary", issueSummary); map.put("description", issueDescription); map.put("reporter", issueReporter); final StringBuilder sb = new StringBuilder(); for (final Map.Entry<?, ?> entry : map.entrySet()) { if (sb.length() > 0) { sb.append("&"); } sb.append(String.format("%s=%s", urlEncodeUTF8(entry.getKey() .toString()), urlEncodeUTF8(entry.getValue().toString()))); } return String.format("%s%s", rootLink,sb.toString()); } JiraLinkGenerator(final String link); }
JiraLinkGenerator { public String generateLink(final String issueSummary, final String issueDescription, final String issueReporter) { final Map<String, Object> map = new LinkedHashMap<String, Object>(); map.put("summary", issueSummary); map.put("description", issueDescription); map.put("reporter", issueReporter); final StringBuilder sb = new StringBuilder(); for (final Map.Entry<?, ?> entry : map.entrySet()) { if (sb.length() > 0) { sb.append("&"); } sb.append(String.format("%s=%s", urlEncodeUTF8(entry.getKey() .toString()), urlEncodeUTF8(entry.getValue().toString()))); } return String.format("%s%s", rootLink,sb.toString()); } JiraLinkGenerator(final String link); String urlEncodeUTF8(String s); String generateLink(final String issueSummary, final String issueDescription, final String issueReporter); }
JiraLinkGenerator { public String generateLink(final String issueSummary, final String issueDescription, final String issueReporter) { final Map<String, Object> map = new LinkedHashMap<String, Object>(); map.put("summary", issueSummary); map.put("description", issueDescription); map.put("reporter", issueReporter); final StringBuilder sb = new StringBuilder(); for (final Map.Entry<?, ?> entry : map.entrySet()) { if (sb.length() > 0) { sb.append("&"); } sb.append(String.format("%s=%s", urlEncodeUTF8(entry.getKey() .toString()), urlEncodeUTF8(entry.getValue().toString()))); } return String.format("%s%s", rootLink,sb.toString()); } JiraLinkGenerator(final String link); String urlEncodeUTF8(String s); String generateLink(final String issueSummary, final String issueDescription, final String issueReporter);  }