testdriven.com Wrangling quality out of chaos

Singleton Unit Testing…

08.21.2004 · Posted in Links · Trackback

Jonathan de Halleux writes: "At first sight it may seem that Singleton and Unit Testing are not compatible since you cannot ensure the separation between the tests. We could solve the problem by instanciating a new ‘Singleton’ instance for each test and apply test on this ‘local’ instance. The problem is that a well implemented Singleton is sealed and it’s constructor are private and thus you cannot create this instance."
link

  • del.icio.us
  • Digg
  • Google Bookmarks
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter
Tags:

Comments are closed