Converts true and false to boolean
All 4 scenarios hold
Cell text converts automatically to the declared parameter type. There is no type converter to write.
Every table below reads the same way. An Input value column holds the text as written in the cell. A Parameter type column holds the type the text converts to. Expectation columns state observable properties of the object the test method receives. Each row therefore shows that the text became a valid object of that type, and not merely that it converted.
The test method signature fixes a parameter type, and no row can vary it. Each type therefore gets its own short table.
A primitive type shares its table with its wrapper. The two are one type in two forms, and a boxed value does not report its primitive type. The value column's own header names it there, in place of a column of its own.
Case does not matter. Each word therefore gets a row in lower case and a row in upper case. A value set does not work here. A set holds converted values, so every spelling of true collapses to one member, and only that member runs.
No other text converts. A cell holding yes or 1 fails, and does not become false. Conversion failures shows that row.
| Scenario | boolean | Boolean | Negated? |
|---|---|---|---|
| True written in lower case | true | true | false |
| True written in upper case | TRUE | TRUE | false |
| False written in lower case | false | false | true |
| False written in upper case | FALSE | FALSE | true |