Skip to main content

Posts

Showing posts with the label groovy

Pointless boolean expression inspection (aka GroovyPointlessBoolean) in Spock tests broken in IntelliJ IDEA

When writing a data driven table test in Spock  where my result is a simple boolean true or false, I discovered that IntelliJ IDEA runs an inspection and decides that the code can be simplified by simply removing the result value.  This means it wants to take a result data table that looks like this: where:  checkpoint   || result  "2018-10-22" || false  And make it look like this: where:  checkpoint   || result  "2018-10-22" ||  After allowing this inspection to make a change,  the test will no longer run.  IntelliJ offers the option to ignore this inspection at the method or class level with an annotation: @SuppressWarnings("GroovyPointlessBoolean") Unfortunately, this solution also causes the code to not compile. The only solution seems to be to either ignore the warning and let the little yellow box remain yellow or to disable this inspection entirely within IntelliJ IDEA.  I chose th...