O'Reilly logo

Extreme Programming Installed by Chet Hendrickson, Ann Anderson, Ron Jeffries

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

Questions About the Example

One of our favorite reviewers wasn't so sure we had tested everything. He asked:

Can the Account Go Negative? How Negative?

Yes, clearly it can, because the balance method just adds up the transactions, without regard to their sign. Does that need a unit test? Not in my opinion, because it can't possibly break.

Does it need an acceptance test? Almost certainly.

Can an Account Have Fractions Less than One Penny?

The code doesn't say. What will determine the answer will be the class of the object that comes back from sending value to a Transaction. That might be something as simple as an Integer or a Float, but it is more likely some kind of monetary type. In any case, the answer isn't here in Account, but in that class. ...

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