main
and test
do not belong to the package name. You would put classes and tests in the same package (i.e. no additional test
in the package name; com.mycompany.app
in the example below), but distributed to main
and test
directory respectively.
Example for a project structure (taken from here):
my-app
|-- pom.xml
`-- src
|-- main
| `-- java
| `-- com
| `-- mycompany
| `-- app
| `-- App.java
`-- test
`-- java
`-- com
`-- mycompany
`-- app
`-- AppTest.java