@@ -0,0 +1,2535 @@
+/*%0A * Bach - Java Shell Builder%0A * Copyright (C) 2019 Christian Stein%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     https://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage it;%0A%0Aimport static java.lang.module.ModuleDescriptor.Requires.Modifier.MANDATED;%0Aimport static java.lang.module.ModuleDescriptor.newModule;%0Aimport static org.junit.jupiter.api.Assertions.assertEquals;%0Aimport static org.junit.jupiter.api.Assumptions.assumeTrue;%0A%0Aimport de.sormuras.bach.Bach;%0Aimport java.util.Set;%0Aimport org.junit.jupiter.api.Test;%0A%0Aclass ModuleSystemTests %7B%0A%0A  @Test%0A  void testModuleIsNamedAndTheNameIsIT() %7B%0A    assumeTrue(getClass().getModule().isNamed(), %22not running on the module path%22);%0A    assertEquals(%22it%22, getClass().getModule().getName());%0A  %7D%0A%0A  @Test%0A  void bachModule() %7B%0A    var actual = Bach.class.getModule().getDescriptor();%0A    assumeTrue(actual != null, %22not running on the module path%22);%0A    // exploded and jarred module fixtures%0A    var expected =%0A        newModule(%22de.sormuras.bach%22)%0A            .exports(%22de.sormuras.bach%22)%0A            .exports(%22de.sormuras.bach.project%22)%0A        // .uses(ToolProvider.class.getName())%0A        // .provides(ToolProvider.class.getName(), List.of(%22de.sormuras.bach.BachToolProvider%22))%0A        ;%0A    // requires may contain compiled version%0A    if (Runtime.version().feature() %3C= 11) %7B%0A      var version = Object.class.getModule().getDescriptor().version().orElseThrow();%0A      expected.requires(Set.of(MANDATED), %22java.base%22, version)%0A      // .requires(Set.of(), %22java.compiler%22, version)%0A      // .requires(Set.of(TRANSITIVE), %22java.net.http%22, version)%0A      ;%0A    %7D else %7B%0A      expected.requires(Set.of(MANDATED), %22java.base%22)%0A      // .requires(Set.of(), %22java.compiler%22)%0A      // .requires(Set.of(TRANSITIVE), %22java.net.http%22)%0A      ;%0A    %7D%0A    // only the jarred module provides the following attributes%0A    actual.version().ifPresent(__ -%3E expected.version(Bach.VERSION));%0A    actual.mainClass().ifPresent(__ -%3E expected.mainClass(%22de.sormuras.bach.Bach%22));%0A    assertEquals(expected.build(), actual);%0A  %7D%0A%7D%0A

Add module system tests