Why does Intellij IDEA suddenly not recognize tests in test folder anymore?

OK, I fixed it.

In menu, under File, there is an invalidate cache option. That fixed it!


On the latest IDE (as of Community Edition 2016.1) this option is more simplified.

right click on the folder you want to be recognized as a source folder:

Mark Directory As -> Sources Root

enter image description here


For some reason Intellij Idea don't recognize classes as Test class that are not explicitly public, in case class has default access specificator it will not be marked as a test. Try to change class to meet this rule. Example:

public class TestMe {
   @Test
   public void shouldTest(){
      Assert.assertEquals("test", "test");
   }
}