title: Is Spring Framework used in a unit test?
body: <p>I am getting ready to take my <em>Spring Certification v5.0</em> and there appears to be a question:  <strong>Do you use Spring in a unit test?</strong> <a href="https://d1fto35gcfffzn.cloudfront.net/academy/Core-Spring-5.0-Certification-Study-Guide.pdf" rel="noreferrer">Link to Exam Guide questions</a>.</p>
  
  <p>From <a href="https://docs.spring.io/spring-framework/docs/current/spring-framework-reference/testing.html#testing" rel="noreferrer">Spring reference guide</a> I know this: </p>
  
  <blockquote>
    <p>The POJOs that make up your application should be testable in JUnit or
    TestNG tests, with objects simply instantiated using the new operator,
    <strong>without Spring or any other container</strong>.</p>
  </blockquote>
  
  <p>From my study as well I can tell that we only are using Spring when testing controllers (like below), repositories or when creating integration tests and maybe some other cases. We would need the TestContext in these cases which is part of <strong>org.springframework.*</strong> package. </p>
  
  <blockquote>
    <p>@RunWith(SpringRunner.class) </p>
    
    <p>@WebMvcTest(HelloWorldController.class)</p>
  </blockquote>
  
  <p>So, is the correct answer of this question: <em>No we do not use Spring?</em> or that, <em>Yes we do need it</em>. Because we obviously use it in some cases. </p>