Add unit test for when executor