#20 internal try/catches can mask error states

closed-fixed
None
9
2008-01-13
2007-06-12
LesRamer
No

Client code can eat an exception generated by NMock and pass a test that it probably shouldn't. The example code exists in a unit test, but it could just as easily be buried in client code that either was passed the Mock or obtained it through a factory.

example...

//...
Expect.Once.On(aSession).GetProperty("Servers").Will(Return.Value(servers));
DtServerCollection retServers = aSession.Servers; // first call... ok
try
{
retServers = aSession.Servers; // second call... should throw
}
catch
{
//eat the exception...
}
//...
mocks.VerifyAllExpectationsHaveBeenMet(); //this doesn't throw, but probably should; nunit test appears to pass

Discussion

  • Richard A. Holden III

    • priority: 5 --> 9
     
  • Richard A. Holden III

    • assigned_to: nobody --> aciddeath
    • status: open --> closed-fixed
     
  • Richard A. Holden III

    Logged In: YES
    user_id=591527
    Originator: NO

    Fixed in CVS, a new build should be coming soon.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks