Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any questionable aspect on creating another module for tests purpose only? #13

Open
lucaguada opened this issue Feb 21, 2023 · 0 comments

Comments

@lucaguada
Copy link

lucaguada commented Feb 21, 2023

Sorry, I know this is more a question than an issue, but I got confused by some objections I had to face on testing in a modular context that I want to be cleared :)

Let's suppose we have the following project structure:

src/
  main/
    java/
      my.library/
        internals/
          Internal.java
        Util.java
      module-info.java

with the following module-info:

module my.library {
  exports my.library;
}

In order to make tests on Internal.java as well, I have to define another module-info with the following project structure for test folder only, and fix the original module-info:

src/
  main/
    java/
      my.library.test/               <<<<< pay attention
        internals/
          InternalTest.java
        UtilTest.java
      module-info.java

with the following module-info:

open module my.library.test {
  requires my.library;

  requires // junit, assert4j, ...
}

with the fix for the original module-info:

module my.library {
  exports my.library;
  exports my.library.internals to my.library.test;
}

Do you know if there is any evident issue with this approach? Unfortunately, this is the only way I found to make IntelliJ happy.

Thank you in advance for any reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant