Skip to content

Instantly share code, notes, and snippets.

@searls
Created October 23, 2010 16:20
Show Gist options
  • Save searls/642384 to your computer and use it in GitHub Desktop.
Save searls/642384 to your computer and use it in GitHub Desktop.
package searls.dougu.examples;
public class Wallet {
private int dollarCount;
public void insertDollars(int numberOfDollars) {
for(int i=0;i<numberOfDollars;i++) {
putADollarInThatWallet(true);
}
}
void putADollarInThatWallet(boolean alwaysTrue) {
if(!alwaysTrue) {
//Maybe I had fun test-driving a whole bunch of logic in here!
//Too bad it's effectively unreachable by production code
//And missing code coverage can't tell me this might be dead code
}
//Oh, and good luck refactoring this method, since
//our test code is now tightly coupled to this implementation
dollarCount++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment