Indentations break the feed.
[SquirrelJME.git] / buildSrc / src / main / java / cc / squirreljme / plugin / multivm / VMTestInputs.java
blob54fc45d9ab44eca6f19a073960ca315aa483396e
1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc.squirreljme.plugin.multivm;
12 import java.nio.file.Path;
13 import java.util.Collection;
14 import java.util.LinkedHashSet;
15 import java.util.concurrent.Callable;
17 /**
18 * This represents the inputs for the test, which files will get the actual
19 * testing performed on them.
21 * @since 2020/09/06
23 public class VMTestInputs
24 implements Callable<Iterable<Path>>
26 /** The task executing under. */
27 protected final VMExecutableTask task;
29 /** The source set working under. */
30 protected final String sourceSet;
32 /**
33 * Initializes the handler.
35 * @param __task The task testing under.
36 * @param __sourceSet The source set.
37 * @throws NullPointerException On null arguments.
38 * @since 2020/09/06
40 public VMTestInputs(VMExecutableTask __task, String __sourceSet)
41 throws NullPointerException
43 if (__task == null || __sourceSet == null)
44 throw new NullPointerException("NARG");
46 this.task = __task;
47 this.sourceSet = __sourceSet;
50 /**
51 * {@inheritDoc}
52 * @since 2020/09/06
54 @Override
55 public Iterable<Path> call()
57 Collection<Path> result = new LinkedHashSet<>();
59 // The source and result of the test make up the input
60 for (CandidateTestFiles file : VMHelpers.runningTests(
61 this.task.getProject(), this.sourceSet).tests.values())
63 result.add(file.sourceCode.getAbsolute());
65 // The expected results are optional
66 if (file.expectedResult != null)
67 result.add(file.expectedResult.getAbsolute());
70 return result;