@Test void getHeloNameShouldReturnLocalhostOnDomainListException() throws DomainListException { when(domainList.getDefaultDomain()).thenThrow(new DomainListException("any message")); HeloNameProvider heloNameProvider = new HeloNameProvider(null, domainList); assertThat(heloNameProvider.getHeloName()).isEqualTo(HeloNameProvider.LOCALHOST); }
public String getHeloName() { if (heloName == null) { try { return domainList.getDefaultDomain().name(); } catch (DomainListException e) { LOGGER.warn("Unable to access DomainList", e); return LOCALHOST; } } else { return heloName; } }
HeloNameProvider { public String getHeloName() { if (heloName == null) { try { return domainList.getDefaultDomain().name(); } catch (DomainListException e) { LOGGER.warn("Unable to access DomainList", e); return LOCALHOST; } } else { return heloName; } } }
HeloNameProvider { public String getHeloName() { if (heloName == null) { try { return domainList.getDefaultDomain().name(); } catch (DomainListException e) { LOGGER.warn("Unable to access DomainList", e); return LOCALHOST; } } else { return heloName; } } HeloNameProvider(String heloName, DomainList domainList); }
HeloNameProvider { public String getHeloName() { if (heloName == null) { try { return domainList.getDefaultDomain().name(); } catch (DomainListException e) { LOGGER.warn("Unable to access DomainList", e); return LOCALHOST; } } else { return heloName; } } HeloNameProvider(String heloName, DomainList domainList); String getHeloName(); }
HeloNameProvider { public String getHeloName() { if (heloName == null) { try { return domainList.getDefaultDomain().name(); } catch (DomainListException e) { LOGGER.warn("Unable to access DomainList", e); return LOCALHOST; } } else { return heloName; } } HeloNameProvider(String heloName, DomainList domainList); String getHeloName(); static final String LOCALHOST; }