billroper: (Default)
So I wrote a new method for the project that I've been working on. It wasn't an overly complex method, but it was slightly annoying to write and might actually have been written in some "doomed to fail" way by mistake, so I said to myself, "Well, self, why don't you just write a unit test and make sure that it works?"

This was a good question with a simple answer, so I wrote the unit test. After a bit of futzing around with types (generics were in play), I got the unit test to work and determined that the new method was putting out what it was supposed to given the inputs I had given it. Good enough.

Let me go add it to the list of unit tests so that it will get run when I check this mess in again.

Hey, as long as I'm adding the unit test to the list, let's run the subset of unit tests that exercise my code.

Why are these unit tests failing?

It turns out that I had made a change that converted an ISO currency code I was using from upper case to lower case. This would seem harmless and -- in some better universe -- it would be. However, the Java Currency.getInstance() method stubbornly insists that it is only going to play nice if the currency code is in upper case.

I have patched the code so that the currency code is now upper case again.

Sheesh.

So much to my surprise, a unit test has done what it was supposed to do. This is a first in my experience...

Profile

billroper: (Default)
billroper

May 2025

S M T W T F S
     1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21222324
25262728293031

Syndicate

RSS Atom

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 23rd, 2025 02:28 am
Powered by Dreamwidth Studios
OSZAR »