### Question:
LayerDistributor implements Serializable { public List<List<Double>> distribute(final List<SectionData> sectionDataList) { final List<LayerData> layerList = groupSectionsByZ(sectionDataList); Collections.sort(layerList); bucketList = bucketLayers(layerList); final List<List<Double>> distributedZValues = new ArrayList<>(numberOfBuckets); distributedZValues.addAll(bucketList.stream().map(Bucket::getOrderedZValues).collect(Collectors.toList())); return distributedZValues; } LayerDistributor(final int numberOfBuckets); List<List<Double>> distribute(final List<SectionData> sectionDataList); long getMinBucketTileCount(); long getMaxBucketTileCount(); @Override String toString();  }### Answer:
@Test public void testDistribute() throws Exception { final int numberOfBuckets = 3; final List<Long> tileCounts = LongStream.of(10, 10, 30, 28, 7, 9).boxed().collect(Collectors.toList()); final List<SectionData> sectionDataList = new ArrayList<>(); double z = 1.0; for (final Long tileCount : tileCounts) { sectionDataList.add(new SectionData(String.valueOf(z), z, tileCount, 0.0, 0.0, 0.0, 0.0)); z += 1; } final LayerDistributor layerDistributor = new LayerDistributor(numberOfBuckets); final List<List<Double>> list = layerDistributor.distribute(sectionDataList); Assert.assertEquals("invalid number of buckets", numberOfBuckets, list.size()); Assert.assertEquals("invalid min tile count", 29, layerDistributor.getMinBucketTileCount()); Assert.assertEquals("invalid max tile count", 35, layerDistributor.getMaxBucketTileCount()); }