Elektrine lite

← Feed

@phillmv@hachyderm.io

Post #2270889

2026-05-08 19:00 UTC

@alwayscurious@infosec.exchange @AT1ST@mstdn.ca @brib@bribstodon.xyz @jneen@unstable.systems in static languages the mock satisfies the type; in Go we use an interface but in Java you could have an abstract class iirc? it's just more work but the same basic idea applies > and I often don’t know the expected behavior before I write the code writing the tests performs this same function; start a high level then get more specific, writing the tests teaches you what you want the program to do :)

Replies (1)

  • @AT1ST@mstdn.ca 2026-05-08 19:29

    @phillmv@hachyderm.io @alwayscurious@infosec.exchange @brib@bribstodon.xyz @jneen@unstable.systems In Java both an interface and an Abstract Class could satisfy the type, though an Abstract Class IIRC does need a concrete extension of it to construct it as an object to use. That said, the Abstract Class would allow you to say "There is a function I do implement, and there is a function I just define and it's up to classes extending this abstract class/inheriting this abstract class to define.". I think you are probably right though that one reason I also find myself disliking mocks is that it's a *lot* of work to do in Java.

    Open ##2270890