Blog Archives

How to verify a method actually gets called – without a mocking framework

hard-labor

Hard labor

You have busted your bum writing a solid MagnificentValidation validation method that checks the input data for a whole slew of data manipulation methods. And you, of course, covered it with unit tests so nobody, not even you, can accidentally mess up the validation logic without it being noticed.

Read more ›




How can you check a validation method is called if it just returns an error code

The strategy laid out in Testing strategy for validation and action methods calls for a single test per action method, to show that it actually calls the validation method.

With an exception throwing validation method that test is simple. But with error code returning validation –

Read more ›




Verify a validation method is called that doesn’t throw exceptions

The strategy laid out in Testing strategy for validation and action methods calls for a single test per action method, to show that it actually calls the validation method.

Validation methods throwing exceptions on invalid input provide you with a handy means of checking whether it has been called by your action methods.

Read more ›




Testing strategy for validation and action methods

How do you test a set of methods that call each other without repeating yourself unnecessarily?

You are more than tired of debugging “List index out of bounds”, “Duplicates not allowed” and similar exceptions. You want some help from your code so you don’t have to hit “Next” until you are blue in the face to figure out the information not contained in the standard exception messages.

Read more ›




Show Buttons
Hide Buttons