开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

[TDD] One Test for the Road


 

That NullPointerException thing.

Well, Java is not really elegant here, but to me it is
good software craftsmanship not to throw misleading
exceptions.

I would suggest:

testMissingRates()
{
try
{
exchange.convert(new Money(10,"USD"), "XXX");
fail("should have thrown IllegalArgumentException");
}
catch(IllegalArgumentException expected)
{}
}

That one is a RuntimeException as well.


I'm sorry for my typos like "examl" and GBR instead of GBP.

cheers
Dierk


 

little typo

p. 34
"Note also that [we] are using...]

cheers
Dierk