9. Februar 2012

Powerful asserts in Groovy 1.7-beta

This will make every TDD/Groovy enthusiast happy: Groovy 1.7 will contain powerful assertions. This assertion here

assert new File('foo.bar') == new File('example.txt')

will yield this output:

Caught: Assertion failed:
 
assert new File('foo.bar') == new File('example.txt')
       |                   |  |
       foo.bar             |  example.txt
                           false

Isn’t that cool?
Read more about the new Features in Groovy 1.7.

Diese Artikel könnten Sie noch interessieren:

  1. Groovy is groovy For AndroMDA 4, I designed a plugin registry configuration language...
  2. “Soft assertions” in Groovy Ted Naleid hat einen guten Artikel über Unit-Testing mit Soft...
  3. Do you want to know who is near you? Imagine you see “the most beautiful girl in the world”...

Kommentare

  1. Wow! Bin beeindruckt! Sehr schöne Darstellung in der Konsole.

    Bislang war der “Inhalt” dessen, was verglichen wurde, ja meist nicht zu sehen und daher schrieb ich quasi immer mein eigenes assertEquals, wie man es in JUnit kennt. Ist zwar auch nur ein Einzeiler, aber diese Ära dürfte damit zu Ende gehen – bin überhaupt nicht traurig drum :-)

Ihre Meinung ist uns wichtig

*