@@ -59,7 +59,7 @@ public TestCaseData(final CaseSensitivePath pcs, final CaseSensitivePath splDir,
5959 this .features = fm ;
6060 }
6161
62- public boolean generate (final List <Variant > variantsToTest ) {
62+ public boolean generate (final List <Variant > variantsToTest , final boolean writeConfigs ) {
6363 traces .assertSuccess ();
6464 PathUtils .deleteDirectory (variantsDir .path ()).assertSuccess ();
6565 final Artefact traceToTest = traces .getSuccess ();
@@ -69,17 +69,23 @@ public boolean generate(final List<Variant> variantsToTest) {
6969
7070 for (final Variant v : variantsToTest ) {
7171 traceToTest
72- .generateVariant (v , splDir , variantsDir .resolve (v .getName ()), VariantGenerationOptions .ExitOnError )
72+ .generateVariant (v , splDir , variantsDir .resolve (v .getName ()), VariantGenerationOptions .ExitOnErrorButAllowNonExistentFiles )
7373 // Write ground truth
7474 .bind (groundTruth -> Result .Try (() -> Resources .Instance ().write (
7575 Artefact .class ,
7676 groundTruth .artefact (),
7777 variantsDir .resolve (v .getName ()).resolve ("ground_truth.variant.csv" ).path ())))
7878 // Write configuration
79- .bind (unit -> Result .Try (() -> Resources .Instance ().write (
80- IConfiguration .class ,
81- v .getConfiguration (),
82- variantsDir .resolve (v .getName ()).resolve ("configuration.xml" ).path ())))
79+ .bind (unit -> {
80+ if (writeConfigs ) {
81+ return Result .Try (() -> Resources .Instance ().write (
82+ IConfiguration .class ,
83+ v .getConfiguration (),
84+ variantsDir .resolve (v .getName ()).resolve ("configuration.xml" ).path ()));
85+ }
86+
87+ return Result .Success (unit );
88+ })
8389 .assertSuccess ();
8490 }
8591
@@ -211,27 +217,28 @@ public void testGeneration() {
211217 new Variant ("justA" , new FeatureIDEConfiguration (fmf , Collections .singletonList ("A" ))),
212218 new Variant ("justB" , new FeatureIDEConfiguration (fmf , Collections .singletonList ("B" ))),
213219 new Variant ("all" , new FeatureIDEConfiguration (fmf , Arrays .asList ("A" , "B" , "C" , "D" , "E" )))
214- ));
220+ ),
221+ true );
215222 }
216223
217224 @ Test
218225 public void testGenerationWithCustomSample () {
219226 final Sampler sampler = FeatureIDESampler .CreateRandomSampler (5 );
220- assert pcTest1 .generate (sampler .sample (pcTest1 .features ).variants ());
227+ assert pcTest1 .generate (sampler .sample (pcTest1 .features ).variants (), true );
221228 }
222229
223230 @ Test
224231 public void testLinuxSampleGeneration () {
225- assert linuxSample .generate (Arrays . asList (
226- new Variant ("all" , new SayYesToAllConfiguration ())
227- ) );
232+ assert linuxSample .generate (
233+ List . of ( new Variant ("all" , new SayYesToAllConfiguration ())),
234+ false );
228235 }
229236
230237 @ Test
231238 public void testLinuxGeneration () {
232- assert linux .generate (Arrays . asList (
233- new Variant ("all" , new SayYesToAllConfiguration ())
234- ) );
239+ assert linux .generate (
240+ List . of ( new Variant ("all" , new SayYesToAllConfiguration ())),
241+ false );
235242 }
236243
237244 @ Test
0 commit comments