Skip to content
Sharp

Testing · interview question

Why is verifying behavior with Mockito preferable over using real network calls in a test?

Multiple choiceMediumchapter-10-curatedpremiumtestingmocking-with-mockito
Choose one answer
Answer and explanation

Correct answer

A. It isolates the test from network dependencies

Why

Verifying behavior using Mockito allows you to test code without relying on real network calls, which can be slow, unpredictable, and outside your control. This keeps tests fast and reliable by eliminating external dependencies.

Test yourself on Testing

A free test with instant, explained results. No account needed.

Start free test
All Testing questions →