Added unit test for #4777