EEToNetCDFExportDialog extends ProductChangeAwareDialog { static List<File> getExistingFiles(List<File> targetFiles) { final ArrayList<File> existingFiles = new ArrayList<>(); for (File targetFile : targetFiles) { if (targetFile.isFile()) { existingFiles.add(targetFile); } } return existingFiles; } EEToNetCDFExportDialog(AppContext appContext, String helpId);   }
@Test public void testGetExistingFiles_noneExists() { final ArrayList<File> targetFiles = new ArrayList<>(); targetFiles.add(new File("/fantasy/location/target/file")); targetFiles.add(new File("/not/existing/file")); final List<File> existingFiles = EEToNetCDFExportDialog.getExistingFiles(targetFiles); assertNotNull(existingFiles); assertEquals(0, existingFiles.size()); }
@Test public void testGetExistingFiles_oneExists() { final ArrayList<File> targetFiles = new ArrayList<>(); targetFiles.add(new File("/fantasy/location/target/file")); targetFiles.add(TestHelper.getResourceFile("SM_OPER_MIR_OSUDP2_20091204T001853_20091204T011255_310_001_1.zip")); final List<File> existingFiles = EEToNetCDFExportDialog.getExistingFiles(targetFiles); assertNotNull(existingFiles); assertEquals(1, existingFiles.size()); }
@Test public void testGetExistingFiles_twoExists() { final ArrayList<File> targetFiles = new ArrayList<>(); targetFiles.add(TestHelper.getResourceFile("SM_OPER_MIR_BWLF1C_20111026T143206_20111026T152520_503_001_1.zip")); targetFiles.add(new File("/fantasy/location/target/file")); targetFiles.add(TestHelper.getResourceFile("SM_OPER_MIR_OSUDP2_20091204T001853_20091204T011255_310_001_1.zip")); final List<File> existingFiles = EEToNetCDFExportDialog.getExistingFiles(targetFiles); assertNotNull(existingFiles); assertEquals(2, existingFiles.size()); }