Еще один интересный инструмент для тестирования.
https://github.com/spockframework/spock
https://github.com/cherepakhin/spock_test
Пример теста:
class ShoppingCartTest extends Specification { def "verify multiple properties of a ShoppingCart"() { given: ShoppingCart cart = new ShoppingCart() cart.addItem("Apple", 3) cart.addItem("Banana", 2) expect: with(cart) { totalItems == 5 totalPrice == 10.00 items.size() == 2 items.contains(new ShoppingItem("Apple",3)) items.contains(new ShoppingItem("Banana",2)) } }
(GROOVY!!!)
Проведение теста:
$ ./mvnw test [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0