@@ -45,20 +45,24 @@ public InputFile getUnitTestResource(FileSystem fileSystem, String classname) {
45
45
* wasn't found in the root.
46
46
*/
47
47
String lastFileNameComponents = StringUtils .substringAfterLast (fileName , "/" );
48
- if (!StringUtils .isEmpty (lastFileNameComponents )) {
49
- fp = fileSystem .predicates ().and (
50
- fileSystem .predicates ().hasType (InputFile .Type .TEST ),
51
- fileSystem .predicates ().matchesPathPattern ("**/" + fileName .replace ("_" , "+" ))
52
- );
53
48
54
- if (fileSystem .hasFiles (fp )){
55
- /*
56
- * Lazily get the first file, since we wouldn't be able to determine the correct one from just the
57
- * test class name in the event that there are multiple matches.
58
- */
59
- return fileSystem .inputFiles (fp ).iterator ().next ();
60
- }
49
+ if (StringUtils .isEmpty (lastFileNameComponents )) {
50
+ lastFileNameComponents = fileName ;
61
51
}
52
+
53
+ fp = fileSystem .predicates ().and (
54
+ fileSystem .predicates ().hasType (InputFile .Type .TEST ),
55
+ fileSystem .predicates ().matchesPathPattern ("**/" + fileName .replace ("_" , "+" ))
56
+ );
57
+
58
+ if (fileSystem .hasFiles (fp )){
59
+ /*
60
+ * Lazily get the first file, since we wouldn't be able to determine the correct one from just the
61
+ * test class name in the event that there are multiple matches.
62
+ */
63
+ return fileSystem .inputFiles (fp ).iterator ().next ();
64
+ }
65
+
62
66
LOGGER .info ("Unable to locate Objective-C test source file for classname {}. Make sure your test class name matches its filename." , classname );
63
67
return null ;
64
68
}
0 commit comments