~/talk

Java Testing Part 2: Mocks, Stubs, and Spies with Mockito 4

Talkat Great International Developer Summit 2023 · 2023-04-25..04-28· [testing]
links:none on file
slides:none on file

Covers Mockito 4/5 usage with concrete examples: an HTTP Gateway + Astro service that groups astronauts by spacecraft, unit tests that use a mock Gateway to return a hard‑coded AstroResponse and verify getResponse() is called exactly once, and an integration test that hits the real API. Shows argument matchers like anyInt and custom ARG lambdas, uses doThrow for void methods, demonstrates Spring’s @MockBean injection, and explains inline mock maker for mocking static/final methods; all example tests in the repo run and pass.

AI-written summary · about

  1. 0:00The role of testing
  2. 2:15Speaker introduction
  3. 4:42Real-world testing example
  4. 9:22Why use Mockito
  5. 11:51Core principles of mocking
  6. 15:08The Mockito workflow
  7. 17:10Mocks vs. stubs
  8. 18:55Understanding spies
  9. 21:19Spring and BDD approach
  10. 25:44Documentation and setup
  11. 30:07Mockito versions and configuration
  12. 34:03Advanced interaction testing
  13. 39:25Argument matchers
  14. 41:22Handling edge cases and void methods
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.