SpatialBin extends Bin { @Override public String toString() { return String.format("%s{index=%d, numObs=%d, featureValues=%s}", getClass().getSimpleName(), index, numObs, Arrays.toString(featureValues)); } SpatialBin();  SpatialBin(long index, int numFeatures); void write(DataOutput dataOutput); void readFields(DataInput dataInput); static SpatialBin read(DataInput dataInput); static SpatialBin read(long index, DataInput dataInput); @Override String toString();  }
@Test public void testToString() { SpatialBin bin = new SpatialBin(0, 0); assertEquals("SpatialBin{index=0, numObs=0, featureValues=[]}", bin.toString()); bin = new SpatialBin(42, 2); assertEquals("SpatialBin{index=42, numObs=0, featureValues=[0.0, 0.0]}", bin.toString()); bin.setNumObs(13); assertEquals("SpatialBin{index=42, numObs=13, featureValues=[0.0, 0.0]}", bin.toString()); bin.featureValues[0] = 56.7f; bin.featureValues[1] = 8.9f; assertEquals("SpatialBin{index=42, numObs=13, featureValues=[56.7, 8.9]}", bin.toString()); }