Ability to access manifest resource while running unit tests
------------------------------------------------------------

                 Key: SUREFIRE-620
                 URL: http://jira.codehaus.org/browse/SUREFIRE-620
             Project: Maven Surefire
          Issue Type: Improvement
          Components: Junit 4.x support, Maven Surefire Plugin
    Affects Versions: 2.5
         Environment: n/a
            Reporter: Ernst de Haan
            Priority: Minor


Use case:
- my code calls getClass().getPackage().getImplementationVersion() to determine 
the version specified in the manifest
- I would like to test this code, for example making sure the returned string 
is not null

Currently, when I run "mvn test" it does not generate the JAR, nor does it not 
make the META-INF/MANIFEST.MF file available in the classpath.

First question is whether this is a *unit* test or an *integration* test. I 
would say a unit test, because no other code bases are involved, this should be 
within a single module, and not testing any dependencies.

Secondly, is the test valid at all if it uses a resource. I would say "yes", 
because it is even standard functionality offered by J2SE and I consider this a 
good approach to determining meta data from the codebase self.

Thirdly, should the Surefire plugin depend on the JAR being created or should 
it just generate the manifest (and copy/generate other resources?) and stick 
them where the compiled classes go?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to