Search code examples
javainheritanceabstract-classproject-structure

Extends class from above package


I have a package with AbstractTestCase class that I'd like inherit from in all test classes that are in sub-packages, i.e. BaseDaoTestRunner. (See image below)

Project structure

Problem is that I cannot inherit from that class. I know it's some basic mistake, but I'll appreciate every help provided.

Is it because it's in test and not classic src/main?


Solution

  • Is it because it's in test and not classic src/main

    No. It's because it's in the default package, and you can't import any class from the default package.

    Don't, ever, put anything in the default package. Put all your classes under the standard reverse-dns structure: com.mycompany.myproject...