Adding tests for invariant checks in constructors