@Test public void fails_when_incorrect_values_provided() { Map<String, Object> options = new HashMap<>(); options.put("period", 2); options.put("timeunit", "ERR"); options.put("numberOfUnreachableNodesEnabled", "123"); try { ClusterHealthConfiguration.create(options); } catch (Exception e) { assertThat(e).isInstanceOf(ConstructorException.class); } }
public static ClusterHealthConfiguration create(Map<String, Object> options) throws ConfigurationException { ClusterHealthConfiguration conf = new ClusterHealthConfiguration(); Yaml yaml = new Yaml(); String str = yaml.dumpAsMap(options); conf.values = yaml.loadAs(str, ClusterHealthConfiguration.Values.class); return conf; }
ClusterHealthConfiguration { public static ClusterHealthConfiguration create(Map<String, Object> options) throws ConfigurationException { ClusterHealthConfiguration conf = new ClusterHealthConfiguration(); Yaml yaml = new Yaml(); String str = yaml.dumpAsMap(options); conf.values = yaml.loadAs(str, ClusterHealthConfiguration.Values.class); return conf; } }
ClusterHealthConfiguration { public static ClusterHealthConfiguration create(Map<String, Object> options) throws ConfigurationException { ClusterHealthConfiguration conf = new ClusterHealthConfiguration(); Yaml yaml = new Yaml(); String str = yaml.dumpAsMap(options); conf.values = yaml.loadAs(str, ClusterHealthConfiguration.Values.class); return conf; } private  ClusterHealthConfiguration(); }
ClusterHealthConfiguration { public static ClusterHealthConfiguration create(Map<String, Object> options) throws ConfigurationException { ClusterHealthConfiguration conf = new ClusterHealthConfiguration(); Yaml yaml = new Yaml(); String str = yaml.dumpAsMap(options); conf.values = yaml.loadAs(str, ClusterHealthConfiguration.Values.class); return conf; } private  ClusterHealthConfiguration(); static ClusterHealthConfiguration create(Map<String, Object> options); int period(); TimeUnit timeunit(); long reportingRateInMillis(); boolean numberOfUnreachableNodesEnabled(); }
ClusterHealthConfiguration { public static ClusterHealthConfiguration create(Map<String, Object> options) throws ConfigurationException { ClusterHealthConfiguration conf = new ClusterHealthConfiguration(); Yaml yaml = new Yaml(); String str = yaml.dumpAsMap(options); conf.values = yaml.loadAs(str, ClusterHealthConfiguration.Values.class); return conf; } private  ClusterHealthConfiguration(); static ClusterHealthConfiguration create(Map<String, Object> options); int period(); TimeUnit timeunit(); long reportingRateInMillis(); boolean numberOfUnreachableNodesEnabled();  }