Operator { public final Product getTargetProduct() throws OperatorException { return context.getTargetProduct(); } protected  Operator(); void setParameterDefaultValues(); abstract void initialize(); void update(); void computeTile(Band targetBand, Tile targetTile, ProgressMonitor pm); void computeTileStack(Map<Band, Tile> targetTiles, Rectangle targetRectangle, ProgressMonitor pm); void dispose(); final String getId(); final Product[] getSourceProducts(); final void setSourceProducts(Product... products); Product getSourceProduct(); void setSourceProduct(Product sourceProduct); final Product getSourceProduct(String id); final void setSourceProduct(String id, Product product); final String getSourceProductId(Product product); final Product getTargetProduct(); final void setTargetProduct(Product targetProduct); final Object getTargetProperty(String name); Object getParameter(String name); Object getParameter(String name, Object defaultValue); void setParameter(String name, Object value); final Tile getSourceTile(RasterDataNode rasterDataNode, Rectangle region); final Tile getSourceTile(RasterDataNode rasterDataNode,
                                    Rectangle region,
                                    BorderExtender borderExtender); final Logger getLogger(); void stopTileComputationObservation(); final void setLogger(Logger logger); final OperatorSpi getSpi(); final void setSpi(OperatorSpi operatorSpi);  }
@Test public void testThatGetTargetProductMustNotBeCalledFromInitialize() { Operator op = new Operator() { @Override public void initialize() throws OperatorException { getTargetProduct(); } }; try { op.getTargetProduct(); fail("RuntimeException expected: Operator shall not allow calling getTargetProduct() from within initialize()."); } catch (OperatorException ignored) { fail("RuntimeException expected: Operator shall not allow calling getTargetProduct() from within initialize()."); } catch (RuntimeException ignored) { } }