AbstractFormatExporter implements FormatExporter { static boolean mustExport(String bandName, String[] outputBandNames) { if (outputBandNames.length == 0) { return true; } for (final String outputBandName : outputBandNames) { if (outputBandName.equalsIgnoreCase(bandName)) { return true; } } return false; }  @Override void initialize(Product product, ExportParameter exportParameter); @Override void prepareGeographicSubset(NFileWriteable nFileWriteable, ExportParameter exportParameter); @Override void addGlobalAttributes(NFileWriteable nFileWriteable, MetadataElement metadataRoot, ExportParameter exportParameter); @Override void addVariables(NFileWriteable nFileWriteable, ExportParameter exportParameter); @Override abstract void addDimensions(NFileWriteable nFileWriteable);  }
@Test public void testMustExport_emptyArray() { final String[] subsetNames = new String[0]; assertTrue(AbstractFormatExporter.mustExport("whatever", subsetNames)); assertTrue(AbstractFormatExporter.mustExport("we_dont_care", subsetNames)); }
@Test public void testMustExport_nameContainedInSubsetNames() { final String[] subsetNames = new String[]{"to_subset", "this_one_too", "this_also"}; assertTrue(AbstractFormatExporter.mustExport("this_one_too", subsetNames)); assertTrue(AbstractFormatExporter.mustExport("THIS_also", subsetNames)); }
@Test public void testMustExport_nameNotContainedInSubsetNames() { final String[] subsetNames = new String[]{"to_subset", "this_one_too", "this_also"}; assertFalse(AbstractFormatExporter.mustExport("BT_Value", subsetNames)); assertFalse(AbstractFormatExporter.mustExport("I_WANT_THIS", subsetNames)); }