Pregunta

I have a JUnit test. But when I use "Run as -> JUnit" it will succeed, whereas when I use "Cover as -> JUnit" it will fail. Why is that? The code indeed has some problem. In the code I'm using some legacy code(I have no access to change it) which contains a too huge method (over 64KB). Why "Run as -> JUnit" cannot expose this problem?

¿Fue útil?

Solución

When you run with "Cover as" the instrumentation will add extra code in your method (to report when each line/expression is hit within the tests). If your message is already very large, that extra instrumentation may well be pushing it over the 64K limit.

It doesn't mean there's anything wrong with the code - it just means you won't be able to use it in coverage tests :(

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top