Feature { public @Nullable Sample getSample(){ if(mLastSample!=null) return new Sample(mLastSample); else return null; } Feature(@NonNull String name,@NonNull Node n,@NonNull Field dataDesc[]); void addFeatureListener(FeatureListener listener); void removeFeatureListener(FeatureListener listener); void addFeatureLoggerListener(FeatureLoggerListener logger); void removeFeatureLoggerListener(FeatureLoggerListener logger); Date getLastUpdate(); String getName(); Node getParentNode(); boolean isEnabled(); @NonNull Field[] getFieldsDesc(); @Nullable Sample getSample(); void enableNotification(); void read(); void disableNotification(); @Override String toString();  }
@Test public void getSample(){ EmptyFeatureTest f = new EmptyFeatureTest(); final int timestamp = 1000; final byte[] data = new byte[]{10,4}; f.update(timestamp, data, 0); Assert.assertEquals(new Feature.Sample(timestamp, new Number[]{data[0]}, new Field[]{}), f.getSample()); }