tag:blogger.com,1999:blog-3237724005744642470.post1358673802340471988..comments2016-05-11T07:17:43.335+01:00Comments on Captain Debug's Blog: Testing an Object's Internal State with PowerMockRoger Hugheshttp://www.blogger.com/profile/07042290171112551665[email protected]Blogger1125tag:blogger.com,1999:blog-3237724005744642470.post-85047707171290059332011-10-24T15:48:13.750+01:002011-10-24T15:48:13.750+01:00Thank you for sharing that technique! However, I ...Thank you for sharing that technique!<br /><br />However, I feel like it should be used with caution. I can imagine situations where white-box testing can be useful but most of the times I find it a little bit dangerous.<br /><br />Sometimes, having to do a white-box testing can simply indicate a code smell - the offending method can be refactored, its code may be moved to a constructor or to another method.<br /><br />Moreover, encapsulation exists for a reason and white-box testing can create tight coupling between your code and your test.<br /><br />But this is just some skeptical thoughts of a man who tries to play it safe :) and I think your post is great both educational-wise and thought-provoking-wise.<br /><br />Thank you!<br /><br />Sincerely,<br />MykeMykyta "Myke" Protsenkohttp://www.blogger.com/profile/03546625298072439760[email protected]