### Question:
DscResource { @Path("/{code}/sign") @GET @Produces("application/json") public String getDisplayForCode(@PathParam("code") Long dscCode) { _log.info("Starting getDisplayForCode for code " + String.valueOf(dscCode)); SignCodeData data = null; try { data = getDataObject(); } catch (IOException e1) { _log.error("getDisplayForCode Failure:", e1); throw new WebApplicationException(e1, Response.Status.INTERNAL_SERVER_ERROR); } List<CCDestinationSignMessage> messages = data.getDisplayForCode(dscCode); ModelCounterpartConverter<CCDestinationSignMessage, DestinationSign> tcipToJsonConverter = new SignMessageFromTcip(); List<DestinationSign> jsonSigns = new ArrayList<DestinationSign>(); for (CCDestinationSignMessage message : messages) { jsonSigns.add(tcipToJsonConverter.convert(message)); } DestinationSignsMessage outputMessage = new DestinationSignsMessage(); outputMessage.setSigns(jsonSigns); outputMessage.setStatus("OK"); String output = null; try { output = writeJsonObjectToString(outputMessage); } catch (IOException e) { throw new WebApplicationException(e, Response.Status.INTERNAL_SERVER_ERROR); } _log.info("Returning JSON String from getDisplayForCode."); return output; } DscResource(); void setJsonTool(JsonTool tool); @Path("/{code}/sign") @GET @Produces("application/json") String getDisplayForCode(@PathParam("code")
  Long dscCode); @Path("/list") @GET @Produces("application/json") String getAllDisplays();  }### Answer:
@Test public void test2() throws Exception { List<CCDestinationSignMessage> msgs = data.getDisplayForCode(22l); assertNotNull(msgs); assertEquals(2, msgs.size()); CCDestinationSignMessage msg1 = msgs.get(0); assertEquals("MTA BUS", msg1.getMessageText()); assertEquals("MTABC", msg1.getRouteID().getAgencydesignator()); CCDestinationSignMessage msg2 = msgs.get(1); assertEquals("NYCT BUS", msg2.getMessageText()); assertEquals("MTA NYCT", msg2.getRouteID().getAgencydesignator()); }
@Test public void test3() throws Exception { List<CCDestinationSignMessage> msgs = data.getDisplayForCode(1020l); assertNotNull(msgs); assertEquals(2, msgs.size()); CCDestinationSignMessage msg1 = msgs.get(0); assertEquals("ASTORIA 27 AV via 31 ST", msg1.getMessageText()); assertEquals("MTABC", msg1.getRouteID().getAgencydesignator()); CCDestinationSignMessage msg2 = msgs.get(1); assertEquals("WASHINGTON HEIGHTS BROADWAY-168 ST via MADISON AV", msg2.getMessageText()); assertEquals("MTA NYCT", msg2.getRouteID().getAgencydesignator()); }
@Test public void testNewLine() throws Exception { List<CCDestinationSignMessage> msgs = data.getDisplayForCode(3133l); assertNotNull(msgs); assertEquals(1, msgs.size()); CCDestinationSignMessage msg1 = msgs.get(0); assertEquals("PLIMPTON\nE.L. GRANT HWY", msg1.getMessageText()); assertEquals("MTA NYCT", msg1.getRouteID().getAgencydesignator()); ModelCounterpartConverter<CCDestinationSignMessage, DestinationSign> tcipToJsonConverter = new SignMessageFromTcip(); DestinationSign dsc = tcipToJsonConverter.convert(msg1); assertEquals("PLIMPTON E.L. GRANT HWY", dsc.getMessageText()); }