How to test a behaviour?

I’d go for a bit of macros and implement a module that has the repetitive pars and is used by other modules that can override this functionality. S. GenServer for an example: elixir/lib/elixir/lib/gen_server.ex at v1.7.3 · elixir-lang/elixir · GitHub unless your server module implements it’s own terminate/2 the default is called.