Skip to content

Instantly share code, notes, and snippets.

@koduki
Created April 1, 2010 17:05
Show Gist options
  • Save koduki/352082 to your computer and use it in GitHub Desktop.
Save koduki/352082 to your computer and use it in GitHub Desktop.
//パターン1 hoge, foo, barのテストをいい感じに書けない!
class A{
public run(){
return hoge(foo(bar))
}
private hoge(String s) ...
private foo(String s) ...
private bar(String s) ...
}
//パターン2 設計を見直すことでテストも簡単
class A{
private logic = new ALogic()
public run(){
return logic.hoge(logic.foo(logic.bar))
}
}
// パッケージなのでAからは普通に見える
class ALogic{
String hoge(String s) ...
String foo(String s) ...
String bar(String s) ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment