Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide unit tests from Call Hierarchy

In the "Call Hierarchy" View, it shows all methods calling a selected method. I'd like to be able to filter out everything in src/test/java so I can see what actual code is calling, instead of 100 Unit test methods.

I tried adding a name filter on Test but it didn't seem to work. I think that filters based on method name, and I'm using JUnit 4 so method names don't contian test, just an annotation, though our class names generally end in Test or TestIT. Any other ways to filter based on source folder or Class name?

I'm using Indigo with M2Eclipse to configure standard Java projects.

Thanks,

like image 459
RLZaleski Avatar asked Feb 17 '12 00:02

RLZaleski


2 Answers

  1. In the Call Hierarchy view, click the white downwards arrow icon.
  2. Select "Filters...".
  3. Check "Filter Test Code".
  4. Click the refresh button (or press F5).

The test classes and methods should not be visible anymore.

The "Filter Test Code" checkbox was added in Eclipse Photon. In earlier versions, you can select the "Name filter patterns" checkbox and filter tests based on your naming convention (e.g. if the classes end with "Test" then enter *Test).

like image 103
arin Avatar answered Oct 06 '22 15:10

arin


You can define a Working Set that only includes Java source but excludes your unit tests, then select Search Scope > Working Set... in the Call Hierarchy view menu.

Search the help for more details on Working Sets.

like image 20
E-Riz Avatar answered Oct 06 '22 15:10

E-Riz