March 2018
Intermediate to advanced
324 pages
8h 30m
English
Provided that our implementation is basically doing nothing, we are going to focus only on one thing—reading single operands. If the input is a single number (no operators) then it's a valid reverse notation and the value of the number is returned. Anything other than that is considered not a valid RPN for now.
This requirement is translated into these four tests:
public class ReversePolishNotationTest { private ReversePolishNotation reversePolishNotation = new ReversePolishNotation(); @Test(expected = NotReversePolishNotationError.class) public void emptyInputThrowsError() { reversePolishNotation.compute(""); } @Test(expected = NotReversePolishNotationError.class) public void notANumberThrowsError() { ...Read now
Unlock full access