2222import java .nio .charset .StandardCharsets ;
2323import java .nio .file .Files ;
2424import java .nio .file .Path ;
25- import java .util .*;
25+ import java .util .ArrayList ;
26+ import java .util .List ;
27+ import java .util .Map ;
28+ import java .util .Stack ;
2629import java .util .concurrent .ConcurrentHashMap ;
2730
31+ import static io .skippy .core .ClassUtil .getOutputFolder ;
2832import static io .skippy .core .JacocoUtil .mergeExecutionData ;
2933import static io .skippy .core .JacocoUtil .swallowJacocoExceptions ;
3034import static io .skippy .core .SkippyConstants .PREDICTIONS_LOG_FILE ;
31- import static io .skippy .core .ClassUtil .getOutputFolder ;
3235import static java .lang .System .lineSeparator ;
33- import static java .nio .file .StandardOpenOption .*;
36+ import static java .nio .file .StandardOpenOption .APPEND ;
37+ import static java .nio .file .StandardOpenOption .CREATE ;
3438import static java .util .Arrays .asList ;
35- import static java .util .stream .Collectors .joining ;
3639
3740/**
3841 * API that is used by Skippy's JUnit libraries to query for skip-or-execute predictions and to trigger the generation of .exec files.
@@ -114,6 +117,9 @@ private static SkippyTestApi getInstance() {
114117 * @param tag the {@link TestTag}
115118 */
116119 public void tagTest (Class <?> testClass , TestTag tag ) {
120+ if (false == ClassUtil .locationAvailable (testClass )) {
121+ return ;
122+ }
117123 skippyRepository .tagTest (testClass , tag );
118124 }
119125
@@ -125,6 +131,9 @@ public void tagTest(Class<?> testClass, TestTag tag) {
125131 */
126132 public boolean testNeedsToBeExecuted (Class <?> test ) {
127133 return Profiler .profile ("SkippyTestApi#testNeedsToBeExecuted" , () -> {
134+ if (false == ClassUtil .locationAvailable (test )) {
135+ return true ;
136+ }
128137 try {
129138 // re-use prediction made for the first test method in a class for all subsequent test methods
130139 if (predictions .containsKey (test )) {
@@ -179,6 +188,9 @@ public boolean testNeedsToBeExecuted(Class<?> test) {
179188 */
180189 public void before (Class <?> testClass , String testMethod ) {
181190 Profiler .profile ("SkippyTestApi#prepareExecFileGeneration" , () -> {
191+ if (false == ClassUtil .locationAvailable (testClass )) {
192+ return ;
193+ }
182194 swallowJacocoExceptions (() -> {
183195 IAgent agent = RT .getAgent ();
184196 agent .reset ();
@@ -193,6 +205,9 @@ public void before(Class<?> testClass, String testMethod) {
193205 */
194206 public void beforeAll (Class <?> testClass ) {
195207 Profiler .profile ("SkippyTestApi#prepareExecFileGeneration" , () -> {
208+ if (false == ClassUtil .locationAvailable (testClass )) {
209+ return ;
210+ }
196211 swallowJacocoExceptions (() -> {
197212 IAgent agent = RT .getAgent ();
198213 if (isNestedTest ()) {
@@ -214,6 +229,9 @@ public void beforeAll(Class<?> testClass) {
214229 */
215230 public void after (Class <?> testClass , String testMethod ) {
216231 Profiler .profile ("SkippyTestApi#after" , () -> {
232+ if (false == ClassUtil .locationAvailable (testClass )) {
233+ return ;
234+ }
217235 swallowJacocoExceptions (() -> {
218236 IAgent agent = RT .getAgent ();
219237 skippyRepository .after (testClass , testMethod , agent .getExecutionData (true ));
@@ -228,6 +246,9 @@ public void after(Class<?> testClass, String testMethod) {
228246 */
229247 public void afterAll (Class <?> testClass ) {
230248 Profiler .profile ("SkippyTestApi#afterAll" , () -> {
249+ if (false == ClassUtil .locationAvailable (testClass )) {
250+ return ;
251+ }
231252 swallowJacocoExceptions (() -> {
232253 IAgent agent = RT .getAgent ();
233254 var executionData = executionDataStack .lastElement ();
0 commit comments