Navigation to Unit Test

How does intellij determine which test is appropiate for a class when navigating ?

Same package and looking for reference to the class ?? etc

Wondering how it will cope with multiple test classes for one subject under test.

Thanks

1 comment

Via some quick experimentation, it looks as if IDEA searches for test classes that have the the name of the class in the test class name. So for the class 'App', typing Ctrl+Shift+T shows all the following regradless of what package they are in:

  • ApptTest
  • SomeAppTest
  • AppIntegrationTest


If I hve the classes 'Bar' and 'Foo', it will show the test class 'FooAndBarJointTest' in both classes when I type Ctrl+Shift+T.

It does not seem to use references to a class. For example, the following class is not shown in the Ctrl+Shift+T popu up for the 'App' class:

public class SomeTest
{
    @Test
    public void testTwo() throws Exception
    {
        App app = new App();
        app.foo();
    }
}

0

Please sign in to leave a comment.