Added unit test for #5849