March 2018
Intermediate to advanced
324 pages
8h 30m
English
Now that we have a clear definition of when an exception should be thrown, the implementation should be straightforward:
package com.packtpublishing.tddjava.ch03tictactoe;
public class TicTacToe {
public void play(int x, int y) {
if (x < 1 || x > 3) {
throw new RuntimeException("X is outside board");
}
}
}
As you can see, this code does not contain anything else, but the bare minimum required for the test to pass.
We're not adding numbers, nor are we returning anything. It's all about making small changes very fast. ...
Read now
Unlock full access