Created
April 1, 2010 17:05
-
-
Save koduki/352082 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//パターン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