~/talk

Object Oriented JUnit Tests

Talkat Java Day Minsk 2017 · on Saturday, 2017-06-03· [testing]
slides:none on file

JUnit tests suffer from unbreakable dependencies caused by four concrete patterns: static methods, singletons, using new inside methods, and no interfaces; PowerMock can break statics but is a last resort. Ad hoc Mockito mocks bake fragile assumptions (SQL string equality causes false positives). Replace mocks with fakes/doubles — e.g., H2 in-memory DB or a fake GitHub server backed by an XML file — and prefer Hamcrest-style composite matchers so each test is one clear assert that statement.

AI-written summary · about

  1. 0:00Introduction to OOP and testing
  2. 2:50Dependencies in unit tests
  3. 17:07Mocking is evil
  4. 29:57Algorithms in tests are bad
  5. 38:20Object-oriented matchers
  6. 40:30Q&A on testing approaches
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.