concept each test method in category java

appears as: each test method
Java Testing with Spock

This is an excerpt from Manning's book Java Testing with Spock.

The Spock test contains one or more test methods (features in Spock terminology) that examine various aspects of the class under test. Test methods can be named directly with full English sentences. The class under test should be marked with the @Subject annotation, either in each test method individually or at the top of the specification.

CreditCardProcessor is an expensive object. It connects to a bank back end and allows your basket to charge credit cards. Even though the bank has provided dummy credit card numbers for testing purposes, the initialization of the connection is slow. It would be unrealistic to have each test method connect to the bank again. The following listing shows the solution to this problem.