@Test public void getTimestampShouldReturnDefensiveCopy() { Date now = new Date(); MeterValue meterValue = new MeterValue(now, "123"); meterValue.getTimestamp().setTime(TWO_MINUTES_AGO.getTime()); assertEquals(now, meterValue.getTimestamp()); }
public Date getTimestamp() { return new Date(timestamp.getTime()); }
MeterValue { public Date getTimestamp() { return new Date(timestamp.getTime()); } }
MeterValue { public Date getTimestamp() { return new Date(timestamp.getTime()); } MeterValue(Date timestamp, String value);  MeterValue(Date timestamp, String value, ReadingContext context, ValueFormat format, Measurand measurand, Location location, UnitOfMeasure unit); }
MeterValue { public Date getTimestamp() { return new Date(timestamp.getTime()); } MeterValue(Date timestamp, String value);  MeterValue(Date timestamp, String value, ReadingContext context, ValueFormat format, Measurand measurand, Location location, UnitOfMeasure unit); Date getTimestamp(); String getValue(); ReadingContext getContext(); ValueFormat getFormat(); Measurand getMeasurand(); Location getLocation(); UnitOfMeasure getUnit(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
MeterValue { public Date getTimestamp() { return new Date(timestamp.getTime()); } MeterValue(Date timestamp, String value);  MeterValue(Date timestamp, String value, ReadingContext context, ValueFormat format, Measurand measurand, Location location, UnitOfMeasure unit); Date getTimestamp(); String getValue(); ReadingContext getContext(); ValueFormat getFormat(); Measurand getMeasurand(); Location getLocation(); UnitOfMeasure getUnit(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }