@Test public void parse() { Date date = new Date(); Parameters parameters = new Parameters(); parameters.setMetric(BinomialMetrics.NORMAL_APPROX_SYM); parameters.setConfidenceLevel(0.6); parameters.setEffectSize(-0.9); parameters.setSingleShot(false); parameters.setTimeZone(TimeZone.getTimeZone("PST")); parameters.setToTime(date); parameters.setFromTime(date); parameters.parse(); BinomialMetric metric = parameters.getMetricImpl(); assertThat(parameters.getTimeZone(), is(TimeZone.getTimeZone("PST"))); assertThat(parameters.getToTime(), is(date)); assertThat(parameters.getFromTime(), is(date)); assertThat(parameters.getMetric(), is(BinomialMetrics.NORMAL_APPROX_SYM)); assertThat("metric is valid", parameters.getMetricImpl(), instanceOf(NormalApproxSymMetric.class)); assertThat("confidence_level converted to double", parameters.getConfidenceLevel(), equalTo(0.6)); assertThat("effect_size converted to double", parameters.getEffectSize(), equalTo(-0.9)); assertThat("single_shot remains false", parameters.isSingleShot(), is(false)); assertThat("metric contains confidence level", metric.getConfidenceLevel(), equalTo(0.6)); assertThat("metric contains max decisions", metric.getMaxDecisions(), equalTo(DecisionAdjuster.DEFAULT_MAX_DECISIONS)); parameters = new Parameters(); parameters.setMetric(BinomialMetrics.NORMAL_APPROX); parameters.setConfidenceLevel(0.6); parameters.setEffectSize(-0.9); parameters.setSingleShot(true); parameters.parse(); metric = parameters.getMetricImpl(); assertThat("metric is valid", parameters.getMetricImpl(), instanceOf(NormalApproxMetric.class)); assertThat("confidence_level converted to double", parameters.getConfidenceLevel(), equalTo(0.6)); assertThat("effect_size converted to double", parameters.getEffectSize(), equalTo(-0.9)); assertThat("single_shot remains false", parameters.isSingleShot(), is(true)); assertThat("metric contains confidence level", metric.getConfidenceLevel(), equalTo(0.6)); assertThat("metric contains max decisions", metric.getMaxDecisions(), equalTo(1.0)); for (final BinomialMetrics metric_enum : BinomialMetrics.values()) { parameters = new Parameters(); parameters.setMetric(metric_enum); parameters.parse(); assertThat(metric_enum.toString() + " was constructed", parameters.getMetricImpl(), instanceOf(BinomialMetric.class)); } }
public void parse() { if (singleShot) { metricImpl = metric.constructMetric(confidenceLevel, 1.0); } else { metricImpl = metric.constructMetric(confidenceLevel); } }
Parameters implements Cloneable { public void parse() { if (singleShot) { metricImpl = metric.constructMetric(confidenceLevel, 1.0); } else { metricImpl = metric.constructMetric(confidenceLevel); } } }
Parameters implements Cloneable { public void parse() { if (singleShot) { metricImpl = metric.constructMetric(confidenceLevel, 1.0); } else { metricImpl = metric.constructMetric(confidenceLevel); } }  }
Parameters implements Cloneable { public void parse() { if (singleShot) { metricImpl = metric.constructMetric(confidenceLevel, 1.0); } else { metricImpl = metric.constructMetric(confidenceLevel); } }  TimeZone getTimeZone(); void setTimeZone(TimeZone timeZone); Date getFromTime(); void setFromTime(Date fromTime); Date getToTime(); void setToTime(Date toTime); Context getContext(); void setContext(Context value); List<String> getActions(); void setActions(List<String> acts); BinomialMetrics getMetric(); void setMetric(BinomialMetrics met); Double getConfidenceLevel(); void setConfidenceLevel(Double confidenceLevel); Double getEffectSize(); void setEffectSize(Double effectSize); Boolean isSingleShot(); void setSingleShot(Boolean singleShot); Mode getMode(); BinomialMetric getMetricImpl(); void parse(); @Override Parameters clone(); @Override boolean equals(Object obj); @Override int hashCode(); }
Parameters implements Cloneable { public void parse() { if (singleShot) { metricImpl = metric.constructMetric(confidenceLevel, 1.0); } else { metricImpl = metric.constructMetric(confidenceLevel); } }  TimeZone getTimeZone(); void setTimeZone(TimeZone timeZone); Date getFromTime(); void setFromTime(Date fromTime); Date getToTime(); void setToTime(Date toTime); Context getContext(); void setContext(Context value); List<String> getActions(); void setActions(List<String> acts); BinomialMetrics getMetric(); void setMetric(BinomialMetrics met); Double getConfidenceLevel(); void setConfidenceLevel(Double confidenceLevel); Double getEffectSize(); void setEffectSize(Double effectSize); Boolean isSingleShot(); void setSingleShot(Boolean singleShot); Mode getMode(); BinomialMetric getMetricImpl(); void parse(); @Override Parameters clone(); @Override boolean equals(Object obj); @Override int hashCode();  }