/*
 * Bach - Java Shell Builder
 * Copyright (C) 2020 Christian Stein
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package test.modules;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertLinesMatch;

import de.sormuras.bach.ToolShell;
import java.util.List;
import java.util.spi.ToolProvider;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;

class ToolShellTests {

  @Test
  void providers() {
    var expectedToolNames = List.of("bach", "jar", "javac", ">>>>");
    var shell =
        new ToolShell() {
          ToolProvider javac() {
            return computeToolProvider("javac", "java.base", List.of());
          }

          Stream<ToolProvider> providers(String module) {
            return computeToolProviders(module, List.of());
          }
        };
    assertEquals("javac", shell.javac().name());
    assertEquals("jdk.compiler", shell.javac().getClass().getModule().getName());

    var module = "java.base";
    var actualToolNames = shell.providers(module).map(ToolProvider::name).sorted();
    assertLinesMatch(expectedToolNames, actualToolNames.collect(Collectors.toList()));
  }
}

@@ -874,44 +874,8 @@
 er;%0A
-import java.util.stream.Collectors;%0A
 impo
@@ -902,16 +902,16 @@
 Stream;%0A
+
 import o
@@ -1019,20 +1019,22 @@
 Names = 
-List
+Stream
 .of(%22bac
@@ -1268,21 +1268,8 @@
 ers(
-String module
 ) %7B%0A
@@ -1308,22 +1308,27 @@
 oviders(
-module
+%22java.base%22
 , List.o
@@ -1492,38 +1492,8 @@
 );%0A%0A
-    var module = %22java.base%22;%0A
     
@@ -1530,22 +1530,16 @@
 oviders(
-module
 ).map(To
@@ -1625,37 +1625,8 @@
 ames
-.collect(Collectors.toList())
 );%0A 

Use stream instead of list