1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.surefire.api.testset;
20
21 import java.io.File;
22 import java.util.ArrayList;
23 import java.util.List;
24
25
26
27
28
29
30 public class TestRequest {
31 private final List<File> suiteXmlFiles;
32
33 private final File testSourceDirectory;
34
35 private final TestListResolver requestedTests;
36
37 private final int rerunFailingTestsCount;
38
39 public TestRequest(List suiteXmlFiles, File testSourceDirectory, TestListResolver requestedTests) {
40 this(createFiles(suiteXmlFiles), testSourceDirectory, requestedTests, 0);
41 }
42
43 public TestRequest(
44 List suiteXmlFiles, File testSourceDirectory, TestListResolver requestedTests, int rerunFailingTestsCount) {
45 this.suiteXmlFiles = createFiles(suiteXmlFiles);
46 this.testSourceDirectory = testSourceDirectory;
47 this.requestedTests = requestedTests;
48 this.rerunFailingTestsCount = rerunFailingTestsCount;
49 }
50
51
52
53
54
55
56 public List<File> getSuiteXmlFiles() {
57 return suiteXmlFiles;
58 }
59
60
61
62
63
64
65 public File getTestSourceDirectory() {
66 return testSourceDirectory;
67 }
68
69
70
71
72
73
74 public TestListResolver getTestListResolver() {
75 return requestedTests;
76 }
77
78
79
80
81
82
83 public int getRerunFailingTestsCount() {
84 return rerunFailingTestsCount;
85 }
86
87 private static List<File> createFiles(List suiteXmlFiles) {
88 if (suiteXmlFiles != null) {
89 List<File> files = new ArrayList<>();
90 Object element;
91 for (Object suiteXmlFile : suiteXmlFiles) {
92 element = suiteXmlFile;
93 files.add(element instanceof String ? new File((String) element) : (File) element);
94 }
95 return files;
96 }
97 return null;
98 }
99 }