title: Mock a static field in a Spring JUnit test
body: <p>I am currently working on a Spring boot project. I'm writing a JUnit 5 test for a class which is as follows,</p>
  <pre><code>class TheClassUnderTest {
  
   public String methodToTest() {
     Map&lt;Integer, Object&gt; collection = SomeOtherClass.someStaticField;
    /*
       Some processing logic
    */
    
   }
  
  }
  </code></pre>
  <p>I want to know if there is a way to mock the usage of &quot;SomeOtherClass.someStaticField&quot; so that I can test my class &quot;TheClassUnderTest&quot;. I also use Mockito, so any answers using Mockito are also welcome</p>