Add test for thread replace.