I am having problems with unit tests in intelliJ. I looked at other forums where people had similar problems, but so far I still have not been able to get it to work. This is mistake:
java.lang.IllegalStateException: Failed to load ApplicationContext ... Caused by: java.io.FileNotFoundException: class path resource [com/d1/d2/service/ServiceTest-context.xml] cannot be opened because it does not exist
In my test, I:
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "ServiceTest-context.xml") public class ServiceImplTest ....
I obviously confirmed that the file exists where it searches for it in the called line. I also read the suggestion to check the output directory, and I also confirmed that it exists there. Is there anything else that stands out to you? I can run tests from the command line using ant, but I would like to be able to run individual classes, not modules.
Project:
IntelliJ_project src test com d1 d2 otherStuff ... ... service ServiceImplTest.java ServiceTest-context.xml
outputFolder:
test-classes (output folder) com d1 d2 service ServiceImplTest.class
So it turns out that I was looking for the wrong directory for output. The context file does not get to the output location. How do I get it?
source share