MagicWandModel implements Cloneable { public static List<Band> getSpectralBands(Product product) { List<Band> bands = new ArrayList<>(); for (Band band : product.getBands()) { if (band.getSpectralWavelength() > 0.0 || band.getSpectralBandIndex() >= 0) { bands.add(band); } } Collections.sort(bands, new SpectralBandComparator()); return bands; } MagicWandModel(); void addListener(Listener listener); void removeListeners(); void fireModelChanged(boolean recomputeMask); @SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException") @Override MagicWandModel clone(); void assign(MagicWandModel other); List<String> getBandNames(); void setBandNames(String... bandNames); void setBandNames(List<String> bandNames); PickMode getPickMode(); void setPickMode(PickMode pickMode); PixelTest getPixelTest(); void setPixelTest(PixelTest pixelTest); SpectrumTransform getSpectrumTransform(); void setSpectrumTransform(SpectrumTransform spectrumTransform); double getTolerance(); void setTolerance(double tolerance); double getMinTolerance(); void setMinTolerance(double minTolerance); double getMaxTolerance(); void setMaxTolerance(double maxTolerance); void setNormalize(boolean normalize); void setSpectralBandNames(Product product); static List<Band> getSpectralBands(Product product); @Override boolean equals(Object o); @Override int hashCode(); static MagicWandModel fromXml(String xml); String toXml();  }
@Test public void testGetSpectralBands() throws Exception { MagicWandModel model = new MagicWandModel(); List<Band> bands; bands = model.getBands(product); assertEquals(0, bands.size()); model.setBandNames("b1", "b2", "b3"); bands = model.getBands(product); assertEquals(3, bands.size()); assertSame(b1, bands.get(0)); assertSame(b2, bands.get(1)); assertSame(b3, bands.get(2)); model.setBandNames("b1", "c2", "b3"); bands = model.getBands(product); assertEquals(null, bands); }