Google Cloud Professional Cloud Developer — Question 187

You are planning to add unit tests to your application. You need to be able to assert that published Pub/Sub messages are processed by your subscriber in order. You want the unit tests to be cost-effective and reliable. What should you do?

Answer options

Correct answer: D

Explanation

Using the Pub/Sub emulator allows you to simulate the Pub/Sub environment without incurring costs, making it a cost-effective solution for reliable unit testing. The other options either complicate the testing setup or may not guarantee the order of message processing needed for effective assertions.