### Question:
SchemaController { @RequestMapping(value = "/prefixes", method = RequestMethod.GET) @ResponseBody public String getPrefixes(HttpServletRequest request) { String prefixes; if ("csv".equalsIgnoreCase(getRequestType(request))) { prefixes = tabularPrefixes(","); } else if ("tsv".equalsIgnoreCase(getRequestType(request))) { prefixes = tabularPrefixes("\t"); } else { prefixes = jsonPrefixes(); } return prefixes; }  @RequestMapping(value = "/interactionTypes", method = RequestMethod.GET) @ResponseBody String getInteractionTypes(HttpServletRequest request); @RequestMapping(value = "/interactionFields", method = RequestMethod.GET) @ResponseBody String getInteractionFields(HttpServletRequest request); @RequestMapping(value = "/prefixes", method = RequestMethod.GET) @ResponseBody String getPrefixes(HttpServletRequest request);  }### Answer:
@Test public void prefixesCSV() throws IOException { HttpServletRequest request = Mockito.mock(HttpServletRequest.class); when(request.getParameter("type")).thenReturn("csv"); String prefixes = new SchemaController().getPrefixes(request); assertThat(prefixes, containsString("id_prefix,url_prefix,url_suffix")); assertThat(prefixes, containsString("EOL:,http: }
@Test public void prefixesTSV() throws IOException { HttpServletRequest request = Mockito.mock(HttpServletRequest.class); when(request.getParameter("type")).thenReturn("tsv"); String prefixes = new SchemaController().getPrefixes(request); assertThat(prefixes, containsString("id_prefix\turl_prefix\turl_suffix")); assertThat(prefixes, containsString("EOL:\thttp: }
@Test public void prefixesJSON() throws IOException { HttpServletRequest request = Mockito.mock(HttpServletRequest.class); when(request.getParameter("type")).thenReturn("json"); String prefixes = new SchemaController().getPrefixes(request); JsonNode jsonNode = new ObjectMapper().readTree(prefixes); assertThat(jsonNode.has("EOL:"), is(true)); assertThat(jsonNode.get("EOL:").get("url_prefix").asText(), is("http: assertThat(jsonNode.get("EOL:").get("url_suffix").asText(), is("")); assertThat(jsonNode.get("bioinfo:ref:").get("url_suffix").asText(), is(".htm")); }