[ 
https://issues.apache.org/jira/browse/SUREFIRE-1811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17153413#comment-17153413
 ] 

Pavel_K commented on SUREFIRE-1811:
-----------------------------------

[~tibordigana]

>I don't think that two JPMS modules can have the same Java package. IMO it was 
>not the target to have no restrictions.

Yes, that it correct.

Look, I think you miss the following thing. There are TWO main approaches for 
unit testing for jpms module.

The first one is that you suggest - we have two descriptors 
main/java/module-info and test/java/module-info. Every descriptor describes 
modules with different names (com.foo.impl and com.foo.impl.test). And when we 
run tests we have two modules. So, nothing difficult here - two simple jpms 
modules.

The second one is that I use (and [~sor] suggests). We again have two 
descriptors main/java/module-info and test/java/module-info. However, in this 
case descriptors give THE SAME NAMES to modules (com.foo.impl). How to explain 
it? It is explained this way - when we run test we have only one module that 
contains classes from main module and classes from test module. So, we have one 
merged module (at least as I undesrtand it) with the descriptor from 
test/java/module-info.

Both approaches are correct from JPMS view. However, the second one gives more 
advantages - see my previous post. And all this issue is about the second 
approach, but not about the first one.

> Add resources to JPMS test module
> ---------------------------------
>
>                 Key: SUREFIRE-1811
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1811
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: Maven Failsafe Plugin
>    Affects Versions: 3.0.0-M5
>            Reporter: Pavel_K
>            Priority: Major
>
> I am testing version 3.0.0-M5 with two module-info in one project - one main 
> and one for test. My test project is here 
> https://github.com/PashaTurok/hibernate-h2-test4 . The problem is with 
> resources. For example, I have  src/main/resources/META-INF/persistence.xml 
> file that is not copied to test module. Because of this it is not possible to 
> find resource in test module and it is necessary to use something like this 
> https://github.com/PashaTurok/hibernate-h2-test4/blob/292e2e683ad72487cbf8d2e5a35dde0d9255001a/src/test/java/com/foo/hibernate/h2/test4/TestIT.java#L72
>  . 
> In target/test-classes/META-INF/jpms.args I see:
> {code:java}
> --patch-module
> my.project=/home/..../hibernate-h2-test4/src/main/java, 
> /home/.../hibernate-h2-test4/target/generated-sources/annotations
> {code}
> As I understand test module will NOT contain resources from the module under 
> test? I mean that test module will NOT contain 
> /home/..../hibernate-h2-test4/src/main/resources? 
> That's why I suggest to include src/main/resources in test module.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to