Measurement { public static Measurement createSimple(final String name, final Double value, final long time, final TimeUnit timeUnit, final Map<String, String> tags, final Map<String, String> fields) { if (value == null) { throw new IllegalArgumentException("Simple measurement must have a value."); } return new Measurement(name, MeasurementType.SIMPLE, value, time, timeUnit, tags, fields); } private  Measurement(final String name, final MeasurementType type, final Double value, final long time,
            final TimeUnit timeUnit, final Map<String, String> tags, final Map<String, String> fields); String name(); MeasurementType type(); boolean isSimple(); boolean isComplex(); double getValue(); double getOrDefault(Double defaultValue); long time(); TimeUnit timeUnit(); Map<String, String> tags(); Map<String, String> fields(); static Measurement createSimple(final String name, final Double value, final long time,
            final TimeUnit timeUnit, final Map<String, String> tags, final Map<String, String> fields); static Measurement createComplex(final String name, final long time, final TimeUnit timeUnit,
            final Map<String, String> tags, final Map<String, String> fields); @Override String toString(); String toJson();  }
@Test(expected = IllegalArgumentException.class) public void should_fail_building_simple_measurement_without_value() { Map<String, String> tags = new HashMap<>(); tags.put("tag1", "tv1"); tags.put("tag2", "tv2"); Map<String, String> fields = new HashMap<>(); fields.put("v2", "abc"); Measurement.createSimple("m1", null, 1434055662, TimeUnit.SECONDS, tags, fields); }