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

Space in expected exception class name causes unit test to be reported as failure in clover report #87

Open
marek-parfianowicz opened this issue Dec 17, 2019 · 2 comments

Comments

@marek-parfianowicz
Copy link
Member

Dave Nichols created an issue 2019-01-09
I have noticed that a space in an expected exception class name causes clover and openclover to mark the test as failed even though the test passed in the junit xml file.

Example: Shows as failed: @test(expected=DbUnavailableException .class) Works successfully: @test(expected=DbUnavailableException.class)

I tried searching through the open issues but was unable to find anything matching this.

I created a sample project @ https://github.com/dpn982/TestFailsInCloverReportButNotJunit

I ran the following commands against it:

mvn clover:setup test clover:aggregate mvn -N clover:clover

The unit tests show as passed in the execution, but if you open the clover html report it shows that 1 out of 2 passed.

@marek-parfianowicz
Copy link
Member Author

Thank you for reporting this problem, Dave.

Potential places which require a trim() call:

com.atlassian.clover.instr.tests.ExpectedExceptionMiner#extractExpectedAttrValue(com.atlassian.clover.registry.entities.MethodSignature, com.atlassian.clover.api.registry.Annotation)

com.atlassian.clover.instr.tests.ExpectedExceptionMiner#extractValueAttrValue(com.atlassian.clover.registry.entities.MethodSignature, java.util.Collection<com.atlassian.clover.api.registry.Annotation>)

com.atlassian.clover.instr.tests.ExpectedExceptionMiner#stripClassNameFromDotClassExpression

and tests:

com.atlassian.clover.instr.tests.DefaultTestDetectorTest#testSingleExpectedAnnotations

com.atlassian.clover.instr.tests.DefaultTestDetectorTest#testMultipleExpectedAnnotations

com.atlassian.clover.instr.tests.DefaultTestDetectorTest#testWeirdExpectedAnnotationStructure

@marek-parfianowicz
Copy link
Member Author

Original report: https://bitbucket.org/openclover/clover/issues/87

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