### Question:
LabelImageProcessorCache extends ImageProcessorCache { Color getColorForUrl(final String url) throws IllegalArgumentException { final Color labelColor = urlToColor.get(url); if (labelColor == null) { throw new IllegalArgumentException("no label color defined for " + url); } return labelColor; } LabelImageProcessorCache(final long maximumNumberOfCachedPixels,
                                    final boolean recordStats,
                                    final boolean cacheOriginalsForDownSampledImages,
                                    final Collection<TileSpec> tileSpecs); static List<Color> buildColorList(); static BufferedImage createEmptyImage(final int width,
                                                 final int height); static final int MAX_LABEL_INTENSITY; }### Answer:
@Test public void testColorMappingConsistency() { final int tileCount = 8000; final Map<String, TileSpec> tileSpecsA = new HashMap<>(tileCount * 2); final Map<String, TileSpec> tileSpecsB = new HashMap<>(tileCount * 2); TileSpec tileSpec; String imageUrl; for (int i = 0; i < tileCount; i++) { tileSpec = new TileSpec(); tileSpec.setTileId(getTileId(i)); imageUrl = "file: final ChannelSpec channelSpec = new ChannelSpec(); channelSpec.putMipmap(0, new ImageAndMask(imageUrl, null)); tileSpec.addChannel(channelSpec); tileSpec.setWidth((double) i); tileSpec.setHeight((double) i + 1); tileSpecsA.put(tileSpec.getTileId(), tileSpec); } for (int i = tileCount - 1; i >= 0; i--) { tileSpec = tileSpecsA.get(getTileId(i)); tileSpecsB.put(tileSpec.getTileId(), tileSpec); } final LabelImageProcessorCache cache1 = new LabelImageProcessorCache(100, false, false, tileSpecsA.values()); final LabelImageProcessorCache cache2 = new LabelImageProcessorCache(100, false, false, tileSpecsB.values()); for (int i = tileCount - 1; i >= 0; i--) { tileSpec = tileSpecsA.get(getTileId(i)); imageUrl = tileSpec.getFirstMipmapEntry().getValue().getImageUrl(); Assert.assertEquals("different label color mapped for second cache instance of " + getTileId(i), cache1.getColorForUrl(imageUrl), cache2.getColorForUrl(imageUrl)); } }