Search code examples
intellij-ideadspace

How to set up unit tests for classes in dspace/modules/additions?


I want to set up unit tests for a curation task that i put in dspace/modules/additions. I use intelliJ IDEA and try to configure sources and tests folders. I wanted to use the following folder structure but could not get the configuration in intelliJ right.

 [] DSpace Source Folder
   [] dspace
     [] modules
        [] additions    
           [] src
              [] main
                 [] java
                    […]
              [] test
                 [] java
                    […]
        [] jspui
        [] oai
        [] rdf
        […] 

Is this structure reasonable?
How can I configure the folders in intelliJ's Project Structure so that it recognises my test folder?

If I try to mark it as "Test Source Folder" in IntelliJ's Project Structure I get the following error message:

Source root "/.../DSpace6/dspace/modules/additions/src/test" cannot be defined in module "dspace" because it belongs to content of nested module "additions"


Solution

  • In IntelliJ's project structure, I selected the dspace module and then, from within this module, chose the additions module. This resulted in an error message described in my question.

    But the additions module also appears as it's own module at the root level of project structure. And at this point, I could define the Test Source Folders as expected.