In How emulators might catch what you might miss, Salih Guler describes a bartender game whose queue worker could charge one order twice. Its test simulated a crash after the charge and before message deletion. The test passed with a mock, but Guler reports that it failed when run against an emulator that gave the redelivered message a fresh receipt handle.
Separate the order from the delivery
The receipt handle belongs to a particular receive operation. The Amazon SQS DeleteMessage reference says another receive of the same message produces a different handle and that deletion uses the most recent one. In Guler's game the worker also used that handle to remember which orders it had charged. Once the visibility timeout expired and the message came back, the worker looked up the new handle and missed the earlier charge.
Consider order 81 in a test queue. The first receive has handle A and the second has handle B. Both carry order 81 in their payload. Guler's revised worker uses the order identifier for the charge check. The queue operation still uses the handle from the current receive. Keeping those values distinct in a test makes it possible to see whether the worker has confused the two jobs.
Assert the effect after the retry
A test for this failure needs to observe both deliveries and inspect the charge after the second one. Let the first invocation record a charge, simulate the interruption before deletion, and let the message become visible again. On the second invocation, verify that the worker saw a different delivery handle and that the order still has only one charge. A storage assertion or a count of accepted requests at the payment boundary can make that last check concrete.
A unit-test fixture with two handles can exercise the same application decision. An emulator can additionally exercise the visibility timeout and receive behavior together. When reviewing a generated queue test, look for the point where the simulated failure happens and for the value that remains stable between attempts. Those details determine whether a green test covers this failure at all.