@@ -340,42 +340,22 @@ public void check(CallGraph cg) {
340
340
}
341
341
}
342
342
343
- protected Collection <String > singleTestSrc () {
344
- return Collections .singletonList (getTestSrcPath () + File .separator + singleJavaInputForTest () );
343
+ protected Collection <String > singleTestSrc (String testName ) {
344
+ return Collections .singletonList (getTestSrcPath () + File .separator + testName + ".java" );
345
345
}
346
346
347
- protected Collection <String > singleTestSrc (final String folder ) {
347
+ protected Collection <String > singleTestSrc (final String folder , String testName ) {
348
348
return Collections .singletonList (
349
- getTestSrcPath () + File .separator + folder + File .separator + singleJavaInputForTest ());
350
- }
351
-
352
- protected Collection <String > singlePkgTestSrc (String pkgName ) {
353
- return Collections .singletonList (
354
- getTestSrcPath () + File .separator + singleJavaPkgInputForTest (pkgName ));
349
+ getTestSrcPath () + File .separator + folder + File .separator + testName + ".java" );
355
350
}
356
351
357
352
protected Collection <String > singlePkgTestSrc (String pkgName , String testName ) {
358
353
return Collections .singletonList (
359
354
getTestSrcPath () + File .separator + pkgName + File .separator + testName + ".java" );
360
355
}
361
356
362
- protected String getTestName () {
363
- StackTraceElement stack [] = new Throwable ().getStackTrace ();
364
- for (int i = 0 ; i <= stack .length ; i ++) {
365
- if (stack [i ].getMethodName ().startsWith ("test" )) {
366
- return stack [i ].getMethodName ();
367
- }
368
- }
369
-
370
- throw new Error ("test method not found" );
371
- }
372
-
373
- protected String [] simpleTestEntryPoint () {
374
- return new String [] {'L' + getTestName ().substring (4 )};
375
- }
376
-
377
- protected String [] simplePkgTestEntryPoint (String pkgName ) {
378
- return new String [] {"L" + pkgName + "/" + getTestName ().substring (4 )};
357
+ protected String [] simpleTestEntryPoint (String testName ) {
358
+ return new String [] {'L' + testName };
379
359
}
380
360
381
361
protected String [] simplePkgTestEntryPoint (String pkgName , String testName ) {
@@ -533,15 +513,11 @@ protected String getTestSrcPath() {
533
513
return testSrcPath ;
534
514
}
535
515
536
- protected String singleJavaInputForTest () {
537
- return getTestName ().substring (4 ) + ".java" ;
538
- }
539
-
540
- protected String singleInputForTest () {
541
- return getTestName ().substring (4 );
516
+ protected String singleInputForTest (String testName ) {
517
+ return testName ;
542
518
}
543
519
544
- protected String singleJavaPkgInputForTest (String pkgName ) {
545
- return pkgName + File .separator + getTestName (). substring ( 4 ) + ".java" ;
520
+ protected String singleJavaPkgInputForTest (String pkgName , String testName ) {
521
+ return pkgName + File .separator + testName + ".java" ;
546
522
}
547
523
}
0 commit comments