SlowQueryConfiguration { public static SlowQueryConfiguration create(Map<String, Object> options) throws ConfigurationException { SlowQueryConfiguration conf = new SlowQueryConfiguration(); Yaml yaml = new Yaml(); String str = yaml.dumpAsMap(options); try { conf.values = yaml.loadAs(str, Values.class); } catch (Exception e) { throw new ConfigurationException("Unable to load configuration.", e); } return conf; } private  SlowQueryConfiguration(); static SlowQueryConfiguration create(Map<String, Object> options); int slowQueryThreshold(); List<String> tablesForLogging(); boolean slowQueryReportEnabled(); boolean slowQueryCountReportEnabled(); int slowQueryCountReportPeriod(); TimeUnit slowQueryCountReportTimeunit(); long slowQueryCountReportingRateInMillis(); List<String> queryTypesToLog();  }
@Test public void fails_when_incorrect_values_provided() { Map<String, Object> options = new HashMap<>(); options.put("slowQueryThresholdInMilliseconds", 11); options.put("tablesForLogging", Arrays.asList("keyspace.table")); options.put("extra", "value"); try { SlowQueryConfiguration.create(options); fail("Configuration loading should fail beacuse of incorrect input values."); } catch (ConfigurationException e) { } }