This is a test design question. I have a class 'handler' that accepts a 'validator' that checks some business logic on what's passed to the handler. I made the unit tests for the validator and now I'm writing the test for the handler. Obviously I want to make sure that the validator is called when the handler does its thing. Should I test the cases of the validator once more or is this pointless?EDIT 1:I'll provide a little more insight about what I'm trying to do here, as it seems that questions has more to it than I expected.What I'm doing is a service to register users for a website and I need to check that the user provided exactly one contact method out of three possible options (email, telephone and postal address). This validation needs to be run both when the user registers in the website and when the user needs to reset his password in case he forgot it. The method that handles the register users goes like this.public Headers HandlePetition(Petition petition){     if (petition == null)     { throw new ArgumentNullException(); }     contactPointValidator.ValidateContactPoint(new ContactData     {          Email = petition.email,          PostalAddress = petition.postaladdress,          Telephone = petition.telephone,     });     var response;     // Do stuff     return response;}
Should unit tests always overlap
unit testing;testing;object oriented design;tdd
I'll post my last comment to fschmengler's answer as an answer since I think that it is the most fitting way to solve my question.I think that my problem was that I was facing the problem the wrong way: the handler shouldn't be validating any of that since it's bussiness logic; not even indirectly as it is doing it now. Both the handler and the validator should be encapsulated by an upper class that uses both. I think that this is making more sense to me.