Spock is a specification-oriented testing framework where your tests are written in a requirements-oriented way. The test cases are written in Groovy, but also use a JUnit test-case runner to execute the test case. Spock uses datasets to drive the test cases. Spock does things based on Behavior-driven development (BDD) to create test cases.
Spock uses specifications to define test cases, which will fail until the requirement is implemented. We can use Spock with Arquillian to execute deployments and run test cases against server-side code.
Let's suppose we have the following requirement:
Certain objects may have a state. States that these objects have can progress from 1 to 5. If one of these objects has state less than 1, then set its state to 1; also, if the state is greater than 5, set its state to 1. The server will expose the code that progresses the state of these objects, which will be sequential from 1 to 5.
From a design standpoint, we make a few assumptions...