Fixes matching errors problem in assertThrow method