-
Book Overview & Buying
-
Table Of Contents
Test-Driven Java Development
Are you ready to code? Let's start with the first requirement.
We should start by defining the boundaries and what constitutes an invalid placement of a piece.
A piece can be placed on any empty space of a 3×3 board.
We can split this requirement into three tests:
RuntimeException is thrown.RuntimeException is thrown.RuntimeException is thrown.As you can see, the tests related to this first requirement are all about validations of the input argument. There is nothing in the requirements that says what should be done with those pieces.
Before we proceed with the first test, a brief explanation of how to test exceptions with JUnit is in order.
Starting from the release 4.7, JUnit introduced a feature called Rule. It can be used to do many different things (more information can be found...
Change the font size
Change margin width
Change background colour