public void addChildrenMeasures(String metricKey, String... values) { for (String value : values) { childrenComponentMeasureByMetricKey.put(metricKey, TestMeasure.createMeasure(value)); } }
public static TestMeasure createMeasure(int intValue) { TestMeasure measure = new TestMeasure(); measure.intValue = intValue; return measure; }
@Test public void create_int_measure() throws Exception { assertThat(TestMeasure.createMeasure(10).getIntValue()).isEqualTo(10); }
@Test public void create_long_measure() throws Exception { assertThat(TestMeasure.createMeasure(10L).getLongValue()).isEqualTo(10L); }
@Test public void create_string_measure() throws Exception { assertThat(TestMeasure.createMeasure("value").getStringValue()).isEqualTo("value"); }
@Test public void create_boolean_measure() throws Exception { assertThat(TestMeasure.createMeasure(true).getBooleanValue()).isTrue(); }
@Test public void create_double_measure() throws Exception { assertThat(TestMeasure.createMeasure(10d).getDoubleValue()).isEqualTo(10d); }
@Test public void getIntValue_fails_with_ISE_when_not_an_int() throws Exception { thrown.expect(IllegalStateException.class); thrown.expectMessage("Not an integer measure"); TestMeasure.createMeasure(10L).getIntValue(); }
@Test public void getLongValue_fails_with_ISE_when_not_a_long() throws Exception { thrown.expect(IllegalStateException.class); thrown.expectMessage("Not a long measure"); TestMeasure.createMeasure(10).getLongValue(); }
@Test public void getStringValue_fails_with_ISE_when_not_a_string() throws Exception { thrown.expect(IllegalStateException.class); thrown.expectMessage("Not a string measure"); TestMeasure.createMeasure(10).getStringValue(); }
@Test public void getBooleanValue_fails_with_ISE_when_not_a_boolean() throws Exception { thrown.expect(IllegalStateException.class); thrown.expectMessage("Not a boolean measure"); TestMeasure.createMeasure(10).getBooleanValue(); } }
@Test public void getDoubleValue_fails_with_ISE_when_not_a_double() throws Exception { thrown.expect(IllegalStateException.class); thrown.expectMessage("Not a double measure"); TestMeasure.createMeasure(10).getDoubleValue(); }
public void addChildrenMeasures(String metricKey, Long... values) { for (Long value : values) { childrenComponentMeasureByMetricKey.put(metricKey, TestMeasure.createMeasure(value)); } }
public static TestMeasure createMeasure(long longValue) { TestMeasure measure = new TestMeasure(); measure.longValue = longValue; return measure; }
public void addChildrenMeasures(String metricKey, Integer... values) { for (Integer value : values) { childrenComponentMeasureByMetricKey.put(metricKey, TestMeasure.createMeasure(value)); } }
public static TestMeasure createMeasure(double doubleValue){ TestMeasure measure = new TestMeasure(); measure.doubleValue = doubleValue; return measure; }
public void addChildrenMeasures(String metricKey, Double... values) { for (Double value : values) { childrenComponentMeasureByMetricKey.put(metricKey, TestMeasure.createMeasure(value)); } }
public static TestMeasure createMeasure(String stringValue) { TestMeasure measure = new TestMeasure(); measure.stringValue = requireNonNull(stringValue, "Value cannot be null"); return measure; }
public void addInputMeasure(String metricKey, int value) { componentMeasureByMetricKey.put(metricKey, TestMeasure.createMeasure(value)); }
public static TestMeasure createMeasure(boolean booleanValue) { TestMeasure measure = new TestMeasure(); measure.booleanValue = requireNonNull(booleanValue, "Value cannot be null"); return measure; }