Quantcast
Channel: JetBrains Developer Community : Thread List - IntelliJ IDEA Users
Viewing all articles
Browse latest Browse all 5661

Mavenized projects and JUnit tests

$
0
0

Hey all:

 

I am still learning the ins-and-outs of Maven and IntelliJ so forgive me if this is a silly question.

 

 

I have a Maven project where I am running JUnit tests against some webflow xml definitions. Each unit test has a relative path to the XML file, for example to load the manage order flow it is - > src/test/resources/config/spring/webflows/manageordertest-flow.xml.

 

So, int the JUnit there is a class level variable that refers to the path above. When I try to run my JUnit test in IntelliJ 12 I get the following exception.

 

Caused by: java.io.FileNotFoundException: src\test\resources\config\spring\webflows\manageordertest-flow.xml (The system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:120)
    at org.springframework.core.io.FileSystemResource.getInputStream(FileSystemResource.java:110)
    at org.springframework.webflow.engine.model.builder.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:98)
    at org.springframework.webflow.engine.model.builder.xml.XmlFlowModelBuilder.init(XmlFlowModelBuilder.java:113)
    ... 31 more

 

When I run the test at the command line it works fine!  ( mvn test -Dtest=Mytest) No errors and all tests are "green".

 

Also, a fellow developer can run the test in Eclipse using the relative path as mentioned above. For me to run the test in IntelliJ I have to give the full path to the XML file (i.e. C:/xxxx/xxx/xxx/xxx/manageordertest-flow.xml)

I have checked my module settings and the xml file and associated test class file are set up and test sources in the sources pane.

Further, I check the output path and both my compiled classes as well as test classes and test resources are located in the appropriate  webapp/target/classes and webapp/target/test-classes directories.

 

 

What am I missing here? Any suggestions or pointers is greatly appreciated!

 

 

Thanks for your help.


Viewing all articles
Browse latest Browse all 5661

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>