Rewrote testBeforeAndAfterWithFormat() tests

A more fail-proof approach to catch unwanted behaviours.