### Question:
SplitCanvasHelper { public void addDerivedTileSpecsToCollection(final Double z, final ResolvedTileSpecCollection resolvedTiles) { final Map<String, Set<String>> splitTileIdMap = zToSplitCanvasMaps.get(z); for (final String originalTileId : splitTileIdMap.keySet()) { final TileSpec originalTileSpec = resolvedTiles.getTileSpec(originalTileId); for (final String derivedTileId : splitTileIdMap.get(originalTileId)) { final TileSpec derivedTileSpec = TileSpec.fromJson(originalTileSpec.toJson()); derivedTileSpec.setTileId(derivedTileId); resolvedTiles.addTileSpecToCollection(derivedTileSpec); } } } SplitCanvasHelper(); List<Double> getSortedZValues(); Set<String> getOriginalIdsForZ(final Double z); int getCanvasCount(); void trackSplitCanvases(final Collection<CanvasMatches> derivedMatchPairs); void addDerivedTileSpecsToCollection(final Double z,
                                                final ResolvedTileSpecCollection resolvedTiles);  }### Answer:
@Test public void testAddDerivedTileSpecsToCollection() throws Exception { final SplitCanvasHelper splitCanvasHelper = new SplitCanvasHelper(); splitCanvasHelper.trackSplitCanvases(CanvasMatches.fromJsonArray(MATCHES_JSON)); final List<Double> zValues = splitCanvasHelper.getSortedZValues(); Assert.assertEquals("invalid number of z values", 2, zValues.size()); for (int i = 0; i < zValues.size(); i++) { final Double z = zValues.get(i); final ResolvedTileSpecCollection resolvedTiles = ResolvedTileSpecCollection.fromJson(RESOLVED_JSON[i]); Assert.assertEquals("invalid number of original tiles", 1, resolvedTiles.getTileCount()); splitCanvasHelper.addDerivedTileSpecsToCollection(z, resolvedTiles); Assert.assertEquals("invalid number of tiles after derivation", 3, resolvedTiles.getTileCount()); resolvedTiles.removeTileSpecs(splitCanvasHelper.getOriginalIdsForZ(z)); Assert.assertEquals("invalid number of tiles after clean-up", 2, resolvedTiles.getTileCount()); } }