ScatterPlotDecoratingStrategy implements FormatStrategy { void updateRasterNamesMaps(Product product) { final long productId = getProductId(product); productNames.put(productId, product.getName()); if (!rasterNamesIndices.containsKey(productId)) { rasterNamesIndices.put(productId, new HashMap<String, Integer>()); } String[] rasterNames = rasterNamesFactory.getRasterNames(product); for (int i = 0; i < rasterNames.length; i++) { String rasterName = rasterNames[i]; rasterNamesIndices.get(productId).put(rasterName, i); } } ScatterPlotDecoratingStrategy(Measurement[] originalMeasurements, FormatStrategy decoratedStrategy,
                                         PixExOp.VariableCombination[] scatterPlotVariableCombinations,
                                         RasterNamesFactory rasterNamesFactory,
                                         ProductRegistry productRegistry, File parentDirectory, String filePrefix); @Override void writeHeader(PrintWriter writer, Product product); @Override void writeMeasurements(Product product, PrintWriter writer, Measurement[] measurements); @Override void finish();  }
@Test public void testFillRasterNamesIndicesMap() { Product product = createProduct("newProduct"); strategy.updateRasterNamesMaps(product); Map<String, Integer> rasterIndices = strategy.rasterNamesIndices.get(PRODUCT_ID_0); assertNotNull(rasterIndices); assertEquals(2, rasterIndices.size()); assertEquals(0, (int) rasterIndices.get("product_sst")); assertEquals(1, (int) rasterIndices.get("product_tsm")); }