사용자 도구

사이트 도구


java:powermock

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

다음 판
이전 판
java:powermock [2015/06/02 10:30]
kwon37xi 만듦
java:powermock [2015/06/02 10:32]
kwon37xi
줄 5: 줄 5:
   * [[http://stackoverflow.com/questions/427750/using-powermock-or-how-much-do-you-let-your-tests-affect-your-design|java - Using PowerMock or How much do you let your tests affect your design? - Stack Overflow]]   * [[http://stackoverflow.com/questions/427750/using-powermock-or-how-much-do-you-let-your-tests-affect-your-design|java - Using PowerMock or How much do you let your tests affect your design? - Stack Overflow]]
     * 어쩔 수 없이 Third Party 라이브러리를 테스트할 때가 아니면 사용하지 말고, Third Party 라도 Anti Corruption Layer를 만들어서 Anti Corruption Layer를 테스트하라.     * 어쩔 수 없이 Third Party 라이브러리를 테스트할 때가 아니면 사용하지 말고, Third Party 라도 Anti Corruption Layer를 만들어서 Anti Corruption Layer를 테스트하라.
 +
 +> I totally agree that Testability is not an end goal, this has been one of the things I have realized when developing PowerMock. I also agree that writing unit tests is one way of getting good design. Using PowerMock should probably be an exception rather than a rule, at least features such as expectations on constructors and static mocking.
 +> The main motivation we have for using PowerMock is when using third party code that prevents your code from being testable. A good alternative is using an anti-corruption-layer that abstracts the third party code and makes it testable. However, sometimes I think the code is cleaner just using the standard APIs. A good example of this is the Java ME API. This is full of static method calls that prevent unit testing.
 +> The same problem can occur with legacy code. Some organizations are extremely afraid of modifying their existing code and in this case PowerMock can be used to introduce unit testing in the parts you are writing at the moment, without forcing big refactorings.
 +> Our problem is specifying a set of best practice rules when to use PowerMock or not that a rookie developer can follow. Creating good design is really hard and since PowerMock gives you more options, maybe it just gets harder for a beginner? I think a more experienced developer appreciates having more choices.
 +> (founder of PowerMock)
  
java/powermock.txt · 마지막으로 수정됨: 2015/06/02 10:32 저자 kwon37xi