Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

1
  • 1
    Many times objects only appear difficult to construct. For instance in this case you could bypass the public constructor by creating a Wrapper class that inherits from the class being tested and allows you to create an instance of the base object in an invalid state. This is where using the correct access modifiers on classes and constructors comes into play and can really be detrimental to testing if used improperly. Additionally avoiding "sealed" classes and method except where appropriate will go a long way to making a code easier to test. Commented Mar 4, 2015 at 21:49