### Question:
SessionIDCorrector { public String translatePrimaryID(String primaryID, String siteID) { return update(new ResolvedServer(primaryID, siteID)).getPrimaryID(); } SessionIDCorrector(Map<String, String> serverToSite); static SessionIDCorrector create(); String translatePrimaryID(String primaryID, String siteID); String translateSiteID(String primaryID, String siteID); @Override String toString(); static final String HEADER; }### Answer:
@Test public void shouldNotChangePrimaryIDWhenNoMappingsPresent() { SessionIDCorrector corrector = generateAutocorrect(""); String result = corrector.translatePrimaryID("01", ""); assertThat(result).isEqualTo("01"); }
@Test public void shouldLeaveServerIDInPrimaryIDFieldWhenBothPrimaryAndSiteIDArePresent() { SessionIDCorrector corrector = generateAutocorrect(""); String result = corrector.translatePrimaryID("01", "02"); assertThat(result).isEqualTo("01"); }
@Test public void shouldLeaveSiteIDEmptyWhenOnlyServerIDIsPresent() { SessionIDCorrector corrector = generateAutocorrect(""); String result = corrector.translatePrimaryID("", "01"); assertThat(result).isNull(); }
@Test public void shouldMapServerToSite() { SessionIDCorrector corrector = generateAutocorrect("01,02"); String result = corrector.translatePrimaryID("", "01"); assertThat(result).isEqualTo("01"); }