jdk/test/java/nio/file/Files/StreamLinesTest.java
changeset 32476 568d6c299cad
parent 31258 8e44e5e2563e
child 33830 9f4be4f1c8b6
equal deleted inserted replaced
32475:d4e63a5e73c8 32476:568d6c299cad
   136         List<Charset> charsets = Arrays.asList(StandardCharsets.UTF_8,
   136         List<Charset> charsets = Arrays.asList(StandardCharsets.UTF_8,
   137                                                StandardCharsets.US_ASCII,
   137                                                StandardCharsets.US_ASCII,
   138                                                StandardCharsets.ISO_8859_1,
   138                                                StandardCharsets.ISO_8859_1,
   139                                                StandardCharsets.UTF_16);
   139                                                StandardCharsets.UTF_16);
   140         String[] lines = {"", "A", "AB", "ABC", "ABCD"};
   140         String[] lines = {"", "A", "AB", "ABC", "ABCD"};
   141         int[] linesSizes = {1, 2, 3, 4, 16, 256, 1024};
   141         int[] linesSizes = {0, 1, 2, 3, 4, 16, 256, 1024};
   142 
   142 
   143         for (Charset charset : charsets) {
   143         for (Charset charset : charsets) {
   144             for (String line : lines) {
   144             for (int linesSize : linesSizes) {
   145                 for (int linesSize : linesSizes) {
   145                 if (linesSize > 0) {
   146                     for (LineSeparator ls : EnumSet.complementOf(EnumSet.of(LineSeparator.NONE))) {
   146                     for (String line : lines) {
   147                         String description = String.format("%d lines of \"%s\" with separator %s", linesSize, line, ls);
   147                         for (LineSeparator ls : EnumSet.complementOf(EnumSet.of(LineSeparator.NONE))) {
   148                         l.add(of(description,
   148                             String description = String.format("%d lines of \"%s\" with separator %s", linesSize, line, ls);
   149                                  i -> line,
   149                             l.add(of(description,
   150                                  i -> ls,
   150                                     i -> line,
   151                                  linesSize, charset));
   151                                     i -> ls,
       
   152                                     linesSize, charset));
       
   153                         }
   152                     }
   154                     }
       
   155                 } else {
       
   156                     l.add(of("Empty file: 0 lines",
       
   157                             i -> "",
       
   158                             i -> LineSeparator.NONE,
       
   159                             0, charset));
   153                 }
   160                 }
   154             }
   161             }
   155         }
   162         }
   156 
   163 
   157         for (Charset charset : charsets) {
   164         for (Charset charset : charsets) {