@Test public void factoryUsesValueInConfig() { final String id = "test-id"; final Config c = ConfigFactory.parseString("iep.leader.leaderId = " + id); final LeaderId leaderId = LeaderId.create(c); assertThat(leaderId).isEqualTo(LeaderId.create(id)); }
public static LeaderId create(Config config) { try { return new LeaderId(config.getString(LEADER_ID_CONFIG_PATH)); } catch (Exception e) { throw new IllegalArgumentException("Invalid '" + LEADER_ID_CONFIG_PATH + "'", e); } }
LeaderId { public static LeaderId create(Config config) { try { return new LeaderId(config.getString(LEADER_ID_CONFIG_PATH)); } catch (Exception e) { throw new IllegalArgumentException("Invalid '" + LEADER_ID_CONFIG_PATH + "'", e); } } }
LeaderId { public static LeaderId create(Config config) { try { return new LeaderId(config.getString(LEADER_ID_CONFIG_PATH)); } catch (Exception e) { throw new IllegalArgumentException("Invalid '" + LEADER_ID_CONFIG_PATH + "'", e); } } private  LeaderId(String id); }
LeaderId { public static LeaderId create(Config config) { try { return new LeaderId(config.getString(LEADER_ID_CONFIG_PATH)); } catch (Exception e) { throw new IllegalArgumentException("Invalid '" + LEADER_ID_CONFIG_PATH + "'", e); } } private  LeaderId(String id); static LeaderId create(Config config); static LeaderId create(String id); String getId(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
LeaderId { public static LeaderId create(Config config) { try { return new LeaderId(config.getString(LEADER_ID_CONFIG_PATH)); } catch (Exception e) { throw new IllegalArgumentException("Invalid '" + LEADER_ID_CONFIG_PATH + "'", e); } } private  LeaderId(String id); static LeaderId create(Config config); static LeaderId create(String id); String getId(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static final LeaderId NO_LEADER; static final LeaderId UNKNOWN; }