Teaching Mockito in a Less Mystical Way

Teaching Mockito in a Less Mystical Way

It was my first time teaching Mockito to a face-to-face class yesterday (I've taught it before to online classes), so it was the first time seeing the expression on their faces. Their eyes turned glassy, so I knew they were lost.

"Are you guys wondering where the heck these objects came from?" I asked.

"Yep."

"Too much magic, eh? Expecto patronum!"

I gave a long-winded explanation of what was basically the Proxy pattern. After I struggled to explain it in a few different ways, they got it and we moved on.

I realize that perhaps I should have started with how we created mocks before we had mocking frameworks. I could have had the IDE generate an implementation of one of the Repositories we were mocking, with stubbed methods, and used that in the test. Probably taking 15 minutes to show how it was done in an "old school" way (~20 years ago?) will allow the trainees to understand what Mockito was doing under the hood.

These trainees (devs of a multinational bank) have been learning an overwhelming amount of "magic" these past few weeks - Spring, JPA... today I'm actually going to cover TestContainers. As a trainer, I need to find ways to demystify the magic.

No alt text provided for this image

要查看或添加评论,请登录

Calen Martin Legaspi的更多文章

  • "Sprint Zero" Activities Can't Fit in One Sprint!

    "Sprint Zero" Activities Can't Fit in One Sprint!

    Extreme Programming (XP), Scrum and Kanban emerged from the rescue of so called "Death March Projects" - projects that…

  • Alternative to Fixed-Price Contracts in Software Development

    Alternative to Fixed-Price Contracts in Software Development

    Overwhelming evidence shows that fixed-price, fixed-scope contracts fail in software development. I won't rehash the…

    4 条评论
  • Story Points Are Not Function Points!

    Story Points Are Not Function Points!

    Story Points are not Function Points! We tried Function Points in the 80s & 90s already and they didn't work! Now many…

  • Why Do We Need the Philippine Skills Framework?

    Why Do We Need the Philippine Skills Framework?

    I have the honor of helping draft the Philippine Skills Framework on Software Development and Security. This is the…

    4 条评论
  • Avoid Custom Fields Unless Absolutely Necessary

    Avoid Custom Fields Unless Absolutely Necessary

    Custom fields..

  • User Stories Come in Many Forms

    User Stories Come in Many Forms

    Kent Beck never specified a format for User Stories. He just basically wanted the elicitation of requirements to be in…

  • Interface-InterfaceImpl Anti-Pattern

    Interface-InterfaceImpl Anti-Pattern

    You don't need to do the Interface - InterfaceImpl anti-pattern. There's a misunderstanding of two design principles:…

    3 条评论
  • First Time Teaching Scrum in School Class

    First Time Teaching Scrum in School Class

    Just some notes on how I'd teach Scrum in a school class the next time around. School Schedules Incompatible with…

  • A Senate of Scientists

    A Senate of Scientists

    We tend to ignore scientists until people start dying on a massive scale. The coronavirus epidemic was predicted by…

    1 条评论

社区洞察

其他会员也浏览了