We found an interesting cock up this morning, in a class implementing AbstractConfigurationEntry, which I've talked about before. Clearly whoever implemented it (and yes, we know the culprit) forgot completely to write a test for it.
Spot the stupid mistake:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StringArrayConfigurationEntry extends AbstractConfigurationEntry<String[]> { | |
public StringArrayConfigurationEntry(String name) { | |
super(name); | |
} | |
@Override | |
public boolean invalid(String[] value) { | |
return false; | |
} | |
@SuppressWarnings("unchecked") | |
@Override | |
protected void loadValueFromProperties(Configuration configuration) throws ConfigurationEntryException { | |
List<String> list = configuration.getList(name); | |
value = new String[list.size()]; | |
} | |
} |
Yes, he really did create a new String array and then forget to put any values in it ...
Annoyingly, this is in library code, so took one of our pairs about 30 minutes longer than it should have to track down a bizarrely unexpected NullPointerException. Obviously the problem couldn't be in the library, since that's used all over the place, so they must have been making a stupid mistake themselves, right?
Sort your tests out, or pay for it.
No comments:
Post a Comment