O'Reilly logo

Test-Driven Java Development - Second Edition by Viktor Farcic, Alex Garcia

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required