GeoBoxHandler extends BaseKlvHandler implements Trimmable { @Override public void trim() { int minListSize = getMinimumListSize(); map.keySet() .forEach( key -> map.computeIfPresent( key, (fieldName, list) -> list.size() > minListSize ? list.subList(0, minListSize) : list)); } GeoBoxHandler(
      String attributeName,
      String latitude1,
      String longitude1,
      String latitude2,
      String longitude2,
      String latitude3,
      String longitude3,
      String latitude4,
      String longitude4); String getLatitude1(); String getLatitude2(); String getLatitude3(); String getLatitude4(); String getLongitude1(); String getLongitude2(); String getLongitude3(); String getLongitude4(); Map<String, List<Double>> getRawGeoData(); @Override Optional<Attribute> asAttribute(); GeoBoxHandler asSubsampledHandler(int subsampleCount); @Override void trim(); @Override void accept(KlvDataElement klvDataElement); @Override void reset(); void accept(String name, Double value);  }
@Test public void testTrim() throws KlvDecodingException { geoBoxHandler.accept(KlvUtilities.createTestFloat(LAT1, 1)); geoBoxHandler.accept(KlvUtilities.createTestFloat(LON1, 2)); geoBoxHandler.accept(KlvUtilities.createTestFloat(LAT2, 3)); geoBoxHandler.accept(KlvUtilities.createTestFloat(LON2, 4)); geoBoxHandler.accept(KlvUtilities.createTestFloat(LAT3, 5)); geoBoxHandler.accept(KlvUtilities.createTestFloat(LON3, 6)); geoBoxHandler.accept(KlvUtilities.createTestFloat(LAT4, 7)); geoBoxHandler.accept(KlvUtilities.createTestFloat(LON4, 8)); geoBoxHandler.accept(KlvUtilities.createTestFloat(LAT1, 9)); geoBoxHandler.accept(KlvUtilities.createTestFloat(LON1, 10)); geoBoxHandler.accept(KlvUtilities.createTestFloat(LAT2, 11)); geoBoxHandler.accept(KlvUtilities.createTestFloat(LON2, 12)); geoBoxHandler.trim(); Map<String, List<Double>> data = geoBoxHandler.getRawGeoData(); assertThat(data.get(LAT1), hasSize(1)); assertThat(data.get(LON1), hasSize(1)); assertThat(data.get(LAT2), hasSize(1)); assertThat(data.get(LON2), hasSize(1)); assertThat(data.get(LAT3), hasSize(1)); assertThat(data.get(LON3), hasSize(1)); assertThat(data.get(LAT4), hasSize(1)); assertThat(data.get(LON4), hasSize(1)); assertThat(data.get(LAT1).get(0), is(closeTo(1, EPSILON))); assertThat(data.get(LON1).get(0), is(closeTo(2, EPSILON))); assertThat(data.get(LAT2).get(0), is(closeTo(3, EPSILON))); assertThat(data.get(LON2).get(0), is(closeTo(4, EPSILON))); assertThat(data.get(LAT3).get(0), is(closeTo(5, EPSILON))); assertThat(data.get(LON3).get(0), is(closeTo(6, EPSILON))); assertThat(data.get(LAT4).get(0), is(closeTo(7, EPSILON))); assertThat(data.get(LON4).get(0), is(closeTo(8, EPSILON))); }