Tnx for replaying, Paul

I'm cheering for API as a bonus :-) Comparing to assert statements, I found it 
a bit more
expressive for DBC context. But it can be considered just a stylistic issue.

My biggest complaint about "assert" statements is the lack of complete support 
for them
in Jacoco code coverage. To my experience, it is impossible to write "assert" 
statement
with 100% branch coverage. And this is very unfortunate when looking in a 
coverage report
for a bigger project since false warnings from "assert" statements hide parts 
in code that
really need more attention.

When I was scratching my head how to deal with that code coverage problem, I 
remembered
almost forgotten DBC approach. I implemented a few Groovy macro methods to 
cover what is
most important to me (namely, "require" precondition checking). Now I have 
simple DBC
precondition checking and correct coverage reports, plus some IDEA GDSL scripts 
to add IDE
auto code completion. If you are interested in the implementation, please take 
a look
at https://github.com/croz-ltd/klokwrk-project and its modules 
"klokwrk-lang-groovy-contracts-simple"
and "klokwrk-lang-groovy-contracts-match". Suggestions are very welcome, of 
course :-)

When adding all these small things up, I believe it is an improvement over 
using "assert"
statements. At least for my purposes. When I finally saw the Groovy 4 road map, 
I was excited
about DBC support and was hoping that DBC API can be taken under consideration 
as well :-)
I hope that I explained above well enough why that is.

Tnx


        

Reply via email to