«« Next » « Previous
«« Next » « Previous

Link Details

Announcement

iPhone DZone: Fresh Links On Your iPhone by matt at Sat Jul 05 14:09:51 EDT 2008

Reading DZone on your iPhone just got a little bit easier. Visit http://dzone.com/iphone from your iPhone to try out our beta iPhone support. You can view stories, filter by tags, and login. We'd appreciate your feedback at feedback@dzone.com.

DZone depends on you. Login and vote now.
Link 81461 thumbnail

By bloid
via googletesting.blogspot.com
Published: May 19 2008 / 10:16

It's hard to test code that uses singletons. Typically, the code you want to test is coupled strongly with the singleton instance. You can't control the creation of the singleton object because often it is created in a static initializer or static method. As a result, you also can't mock out the behavior of that Singleton instance.
  • 11
  • 2
  • 1224
  • 532

Comments

Add your comment
User 204573 avatar

Gene Gotimer replied ago:

0 votes Vote down Vote up Reply

Needs more explanation, as the comments there point out.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.