(PE-2650) tests for add-context-handler function

This commit adds tests for the add-context-handler function.
While at it, the structure of an existing test is changed
to be in line with all the other tests.