Groovy1.7から導入されたPower Assertを試してみた。 これによりassertによる検証エラーが発生した場合の式の状態が詳細に表示され、問題の原因を素早く特定できる。 まずは実行 assertを利用した簡単なコードを記述する。 test.groovy #!/usr/bin/env groovy def list = [1, 3, 4, 5, 2] assert 5 == list.max() - 1ほいで実行。 $ chmod 750 test.groovy $ ./test.groovy Caught: Assertion failed: assert 5 == list.max() - 1 | | | | | | 5 4 | [1, 3, 4, 5, 2] false at test.run(test.groovy:3) これはわかりやすい。ただ、いくつか疑問点が浮かん
![Power Assertを試してみる - ゲンゾウ用ポストイット](https://cdn-ak-scissors.b.st-hatena.com/image/square/06a15c64ba0ceec233d86d71001ebb29a9dcbf5d/height=288;version=1;width=512/https%3A%2F%2Fcdn.blog.st-hatena.com%2Fimages%2Ftheme%2Fog-image-1500.png)