SmsDisplayer { public void manyStopResponse() { addToResponse("Send:\n"); for (SearchResult searchResult : searchResults) { StopSearchResult stopSearchResult = (StopSearchResult) searchResult; String stopIdNoAgency = stopSearchResult.getStopIdNoAgency(); String stopDirection = stopSearchResult.getStopDirection(); addToResponse(stopIdNoAgency + " for " + stopDirection + "-bound\n"); } } SmsDisplayer(List<SearchResult> searchResults); void singleStopResponse(); void noResultsResponse(); void twoStopResponse(); void manyStopResponse(); @Override String toString();  }
@Test public void testManyStopResponse() { List<RouteItem> routes = new ArrayList<RouteItem>(); List<DistanceAway> distanceAways = new ArrayList<DistanceAway>(); distanceAways.add(new DistanceAway(1, 100, new Date(), Mode.SMS,300, FormattingContext.STOP, null)); distanceAways.add(new DistanceAway(2, 200, new Date(), Mode.SMS,300, FormattingContext.STOP, null)); RouteItem availableRoute = makeAvailableRoute(distanceAways); routes.add(availableRoute); List<SearchResult> searchResults = new ArrayList<SearchResult>(); searchResults.add(makeStopSearchResult(routes, "N")); searchResults.add(makeStopSearchResult(routes, "S")); searchResults.add(makeStopSearchResult(routes, "E")); searchResults.add(makeStopSearchResult(routes, "W")); SmsDisplayer sms = new SmsDisplayer(searchResults); sms.manyStopResponse(); String actual = sms.toString(); String exp = "Send:\n" + "123456 for N-bound\n" + "123456 for S-bound\n" + "123456 for E-bound\n" + "123456 for W-bound\n"; assertEquals(exp, actual); }