EEToNetCDFExportDialog extends ProductChangeAwareDialog { static String listToString(List<File> targetFiles) { int fileCount = 0; final StringBuilder stringBuilder = new StringBuilder(); for (File targetFile : targetFiles) { stringBuilder.append(targetFile.getAbsolutePath()); stringBuilder.append("\n"); fileCount++; if (fileCount >= 10) { stringBuilder.append("..."); break; } } return stringBuilder.toString(); } EEToNetCDFExportDialog(AppContext appContext, String helpId);   }
@Test public void testListToString() { final File file_1 = TestHelper.getResourceFile("SM_OPER_MIR_BWLF1C_20111026T143206_20111026T152520_503_001_1.zip"); final File file_2 = TestHelper.getResourceFile("SM_OPER_MIR_OSUDP2_20091204T001853_20091204T011255_310_001_1.zip"); final ArrayList<File> targetFiles = new ArrayList<>(); targetFiles.add(file_1); targetFiles.add(file_2); assertEquals(file_1.getAbsolutePath() + "\n" + file_2.getAbsolutePath() + "\n", EEToNetCDFExportDialog.listToString(targetFiles)); }
@Test public void testListToString_ellipseAfterTenFiles() { final ArrayList<File> targetFiles = new ArrayList<>(); for (int i = 0; i < 14; i++) { targetFiles.add(new File("blabla_" + i)); } assertTrue(EEToNetCDFExportDialog.listToString(targetFiles).contains("...")); }