@@ -45,20 +45,24 @@ public InputFile getUnitTestResource(FileSystem fileSystem, String classname) {
4545 * wasn't found in the root.
4646 */
4747 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- );
5348
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 ;
6151 }
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+
6266 LOGGER .info ("Unable to locate Objective-C test source file for classname {}. Make sure your test class name matches its filename." , classname );
6367 return null ;
6468 }
0 commit comments