@@ -178,17 +178,17 @@ public static Path getAppClassLocation(Class<?> testClass) {
178
178
* @return directory or JAR containing the application being tested by a test from the given location
179
179
*/
180
180
public static Path getAppClassLocationForTestLocation (Path testClassLocationPath ) {
181
- if (testClassLocationPath .endsWith (".jar" )) {
182
- if (testClassLocationPath .endsWith ("-tests.jar" )) {
183
- String testClassLocation = testClassLocationPath .toString ();
181
+ String testClassLocation = testClassLocationPath .toString ();
182
+
183
+ if (testClassLocation .endsWith (".jar" )) {
184
+ if (testClassLocation .endsWith ("-tests.jar" )) {
184
185
return Paths .get (new StringBuilder ()
185
186
.append (testClassLocation , 0 , testClassLocation .length () - "-tests.jar" .length ())
186
187
.append (".jar" )
187
188
.toString ());
188
189
}
189
190
return testClassLocationPath ;
190
191
}
191
- String testClassLocation = testClassLocationPath .toString ();
192
192
Optional <Path > mainClassesDir = TEST_TO_MAIN_DIR_FRAGMENTS .entrySet ().stream ()
193
193
.filter (e -> testClassLocation .contains (e .getKey ()))
194
194
.map (e -> {
@@ -211,7 +211,7 @@ public static Path getAppClassLocationForTestLocation(Path testClassLocationPath
211
211
}
212
212
// could be a custom test classes dir under the 'target' dir with the main
213
213
// classes still under 'target/classes'
214
- p = Path . of ( testClassLocation ) .getParent ();
214
+ p = testClassLocationPath .getParent ();
215
215
if (p != null && p .getFileName ().toString ().equals (TARGET )) {
216
216
p = p .resolve ("classes" );
217
217
if (Files .exists (p )) {
0 commit comments