# Unit testing in Authenticator SPI

**URL:** <https://forum.keycloak.org/t/unit-testing-in-authenticator-spi/12330>\
**Category:** Extending the server\
**Tags:** authentication\
**Created:** [November 27, 2021, 10:24am UTC](https://forum.keycloak.org/t/unit-testing-in-authenticator-spi/12330 "2021-11-27T10:24:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![omidmk567](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/omidmk567/32/4465_2.png) [@omidmk567](https://forum.keycloak.org/u/omidmk567)\
**Post date:** [November 27, 2021, 10:24am UTC](https://forum.keycloak.org/t/unit-testing-in-authenticator-spi/12330/1 "2021-11-27T10:24:36Z")

</div>

Hello everyone, I’m trying to write tests for my authenticator SPI, e.g. Terms and Conditions, for Keycloak. I’ve found the integration tests in the Keycloak GitHub repository, but I prefer unit testing for better coverage. Is there any documentation or sample code for unit testing of an SPI?

---

<div class="post-metadata">

**Author:** ![semangard](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/semangard/32/1922_2.png) [@semangard](https://forum.keycloak.org/u/semangard)\
**Post date:** [December 15, 2021, 5:51am UTC](https://forum.keycloak.org/t/unit-testing-in-authenticator-spi/12330/2 "2021-12-15T05:51:16Z")

</div>

You can do it with some mocks (e.g. mockito).
