I have a maven project in eclipse with a folder structure are follows -
- Project
> src/main/java ..
> src/test/java ..
I found that when I try to initialize any class in the test package from my code in the main package I get a classNotFoundException.
I want to know why this happens and what is the reason for not allowing access to test classes from the main package ?
If your main code needs code in the test folder, then the code in the test folder is not a "test", it is main code. The point of test is that it is independent from your main code and not an integral part.
Otherwise, if you really want to do it, look at the Run Configuration you are using to launch your program and set the classpath to include the test stuff.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With