1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
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
;
18 * This represents the inputs for the test, which files will get the actual
19 * testing performed on them.
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
;
33 * Initializes the handler.
35 * @param __task The task testing under.
36 * @param __sourceSet The source set.
37 * @throws NullPointerException On null arguments.
40 public VMTestInputs(VMExecutableTask __task
, String __sourceSet
)
41 throws NullPointerException
43 if (__task
== null || __sourceSet
== null)
44 throw new NullPointerException("NARG");
47 this.sourceSet
= __sourceSet
;
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());