[
https://jira.jboss.org/jira/browse/JBTM-727?page=com.atlassian.jira.plugi...
]
Andrew Dinn commented on JBTM-727:
----------------------------------
I have found another case where emma gives misleading stats about coverage which also
relates to exception flow. It happens where there is a synchronized block which encloses
an embedded method call:
public void foo()
{
. . .
synchronized (this) {
fooMethod(1, "abc");
}
}
emma may indicate that the line with the brace which closes the synchronized block is only
partially executed. This is because the compiler inserts a catchall handler block for any
exception thrown by fooMethod which is responsible for calling monitorexit to match the
monitorenter planted to implement the synchronization.
...
aload 0
dup
atstore <n>
monitorenter
ldc 1
ldc "abc"
invokevirtual "fooMethod"
aload <n>
monitorexit
goto ...
// catch all:
aload <n>
monitorexit
// goto target
...
If the test code does not actually throw an exception then the catchall handler never gets
executed. The line number associated with the first monitorexit, goto and second monitor
exit is that of the line with the closing brace so this line only gets partial coverage.
Emma coverage missing some method invocations
---------------------------------------------
Key: JBTM-727
URL:
https://jira.jboss.org/jira/browse/JBTM-727
Project: JBoss Transaction Manager
Issue Type: Task
Security Level: Public(Everyone can see)
Components: Testing
Reporter: Mark Little
Assignee: Andrew Dinn
Fix For: 4.11.0
There are some class that emma says don't have coverage and yet there are tests that
do cover them (and I have confirmed the methods get called). For instance
ServerTopLevelOSIActionUnitTest which covers ServerOSITopLevelAction. The commit and
rollback methods are invoked, yet emma misses them.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira