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