/*
 * 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 de.sormuras.bach.project;

/** Source set of {@code test} modules. */
public final class TestSources {

  public static TestSources of() {
    return new TestSources(SourceUnits.of());
  }

  public TestSources with(SourceUnits units) {
    return new TestSources(units);
  }

  public TestSources with(SourceUnit unit) {
    return with(units.with(unit));
  }

  private final SourceUnits units;

  public TestSources(SourceUnits units) {
    this.units = units;
  }

  public SourceUnits units() {
    return units;
  }
}

@@ -666,197 +666,295 @@
 t;%0A%0A
-/** Source set of %7B@code test%7D modules. */%0Apublic final class TestSources %7B%0A%0A  public static TestSources of() %7B%0A    return new TestSources(SourceUnits.of());%0A  %7D%0A%0A  public TestSources with(
+import de.sormuras.bach.internal.Factory;%0Aimport de.sormuras.bach.internal.Factory.Kind;%0A%0A/** Source set of %7B@code test%7D modules. */%0Apublic final class TestSources %7B%0A%0A  private final SourceUnitMap units;%0A%0A  public TestSources(SourceUnitMap units) %7B%0A    this.units = units;%0A  %7D%0A%0A  public 
 Sour
@@ -951,39 +951,42 @@
 ublic SourceUnit
-s
+Map
  units
+(
 ) %7B%0A    return n
@@ -988,30 +988,13 @@
 urn 
-new TestSources(
 units
-)
 ;%0A  
@@ -1002,126 +1002,162 @@
 %0A%0A  
-public TestSources with(SourceUnit unit) %7B%0A    return with(units.with(unit));%0A  %7D%0A%0A  private final SourceUnits units;%0A
+//%0A  // Configuration API%0A  //%0A%0A  @Factory%0A  public static TestSources of() %7B%0A    return new TestSources(SourceUnitMap.of());%0A  %7D%0A%0A  @Factory(Kind.SETTER)
 %0A  p
@@ -1165,32 +1165,38 @@
 blic TestSources
+ units
 (SourceUnits uni
@@ -1186,25 +1186,27 @@
 s(SourceUnit
-s
+Map
  units) %7B%0A  
@@ -1207,34 +1207,45 @@
 ) %7B%0A    
-this.units = 
+return new TestSources(
 units
+)
 ;%0A  %7D%0A%0A 
@@ -1237,39 +1237,82 @@
 (units);%0A  %7D%0A%0A  
-public 
+@Factory(Kind.OPERATOR)%0A  public TestSources with(
 SourceUnits unit
@@ -1305,24 +1305,29 @@
 urceUnit
-s u
+... moreU
 nits
-(
 ) %7B%0A    
@@ -1334,20 +1334,43 @@
 return units
+(units.with(moreUnits))
 ;%0A  %7D%0A%7D%0A

Clean up TestSources's API and member order