Add tests for cases exercising the atomic replacement mechanism