Legislator implements Comparable<Legislator>, Serializable { public static String shortTitle(String longTitle) { if (longTitle.equals("Representative")) return "Rep"; else if (longTitle.startsWith("Senator")) return "Sen"; else if (longTitle.equals("Delegate")) return "Del"; else if (longTitle.equals("Resident Commissioner")) return "Com"; return ""; }  String getName(); String getNameByLastName(); String titledName(); static String trimTitle(String title); static String[] splitName(String displayName); static String shortTitle(String longTitle); String fullTitle(); String getOffice(); static String bioguideUrl(String bioguide_id); static String govTrackUrl(String govtrack_id); String toString(); int compareTo(Legislator another); String twitterUrl(); String youtubeUrl(); String facebookUrl(); public String bioguide_id; public String first_name; public String title; public String gender; public String twitter_id; public String term_start; public boolean in_office; public Date cosponsored_on; public Committee.Membership membership; public List<Committee> committees; }
@Test public void shortTitle() { assertEquals(Legislator.shortTitle("Representative"), "Rep"); assertEquals(Legislator.shortTitle("Senator"), "Sen"); assertEquals(Legislator.shortTitle("Delegate"), "Del"); assertEquals(Legislator.shortTitle("Resident Commissioner"), "Com"); assertEquals(Legislator.shortTitle(""), ""); assertEquals(Legislator.shortTitle("Justice"), ""); }