Requirement – complex operations

Complex operations are difficult to address, because mixing operations makes it really difficult for the non-trained human eye to understand in which order the operations should take place. Also, different evaluation orders usually lead to different results. To solve that, the computation of reverse polish expressions is backed up by the implementation of a queue. These are some tests for our next functionality:

@Testpublic void multipleAddOperationsReturnCorrectValue() {  assertThat(reversePolishNotation.compute("1 2 5 + +"))    .isEqualTo(8);}@Testpublic void multipleDifferentOperationsReturnCorrectValue() {  assertThat(reversePolishNotation.compute("5 12 + 3 -"))    .isEqualTo(14);}@Testpublic void aComplexTest() ...

Get Test-Driven Java Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.