# Using Mockito's InjectMocks

DevFeed: [Using Mockito's InjectMocks](<https://devfeed.tech/articles/using-mockito-s-injectmocks-37781.md>)

Original publisher: [Read original article](<https://carlosbecker.com/posts/injectmocks/>)

Author: Carlos Alexandro Becker

Published: 2015-03-05T00:00:00Z

Content type: tutorial

Language: en

Sources: [Carlos Becker](<https://devfeed.tech/sources/carlos-becker.md>)

Topics: [Testing](<https://devfeed.tech/topics/testing.md>), [Java](<https://devfeed.tech/topics/java.md>)

Tags: [java](<https://devfeed.tech/tags/java.md>), [mock](<https://devfeed.tech/tags/mock.md>), [mockito](<https://devfeed.tech/tags/mockito.md>), [test](<https://devfeed.tech/tags/test.md>), [testing](<https://devfeed.tech/tags/testing.md>), [using](<https://devfeed.tech/tags/using.md>)

## AI overview

A quick Java testing tip that demonstrates how Mockito's @InjectMocks can inject mocked dependencies into a class under test, avoiding manual constructor calls. The article notes that the annotation has limitations but works for most cases.

## Source excerpt

FYI: Like the previous post, this is a really quick tip.