String[] names = { "UNUSED", "Monday", "Tuesday", ... }
try {
return names[i];
} catch(ArrayIndexOutOfBoundsException uhoh) {
return "???";
}
It's so easy...Look, at least it's not a pile of @Inject DayOfWeekLookupAdapter dayOfWeekLookupAdapter with attendant 100kB Spring XML config, of which the unit tests will have their very own special cut and pasted copy. No, I'm not bitter at all.