# Elixir mock (test double) testing seams: a modest proposal

**URL:** <https://forum.devtalk.com/t/elixir-mock-test-double-testing-seams-a-modest-proposal/102176>\
**Category:** Blogs/Articles/Talks/Podcasts\
**Tags:** tdd, elixir, blog-post\
**Created:** [24 March 2023 17:04 UTC](https://forum.devtalk.com/t/elixir-mock-test-double-testing-seams-a-modest-proposal/102176 "2023-03-24T17:04:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulanthonywilson](https://forum.devtalk.com/user_avatar/forum.devtalk.com/paulanthonywilson/32/2494_2.png) [@paulanthonywilson](https://forum.devtalk.com/u/paulanthonywilson)\
**Post date:** [24 March 2023 17:04 UTC](https://forum.devtalk.com/t/elixir-mock-test-double-testing-seams-a-modest-proposal/102176/1 "2023-03-24T17:04:39Z")

</div>

> **[Elixir mock (test double) testing seams: a modest proposal](https://furlough.merecomplexities.com/elixir/tdd/mocks/2023/03/24/elixir-mock-stub-fake-testing-seams-a-modest-proposal.html)**
>
> The José Valim approved (tm) way of introducing mocks1 into Elixir is through using injecting implementations of explicit contracts definned by behaviours. José and pals crystallised this approach with the popular Mox hexicle. e The standard way of...

When using mocks in Elixir, particularly with [Mox](https://hexdocs.pm/mox/Mox.html) then the standard way of loading the implementation is along the lines of `Application.get_env(:cat_facts, CatFacts.CatFactsApi, CatFacts.RealCatFactsApi)` . In this post I suggest an alternative which is a little less flexible, but also safer and avoid extra configuration.
