Monday, March 31, 2014

Refactored my clumsy tests

I've reworked the class and the tests I showed in my previous post.

This is the refactored class:

The responsibility to compose an email from the form fields was delegated to the FormEmailComposer collaborator whereas the responsibility of sending the email was delegated to the EmailSender collaborator.

The Redirection collaborator is still in charge of the redirecting responsibility.

Now the Form and the Email class are just value objects.

These are the new tests:

And this is how I'm using the SendingAndRedirectionAction class:

I'm a bit happier with the naming and I also reduced the number of classes.
However I'm still concerned about the tests fragility.

No comments:

Post a Comment