Mocking and verifying SLF4J with JMockit
<p>I have a class with SLF4J logger instanced like:</p>

<pre><code> public class MyClass {

    private static final Logger log = LoggerFactory.getLogger(MyClass.class);

    public void foo() {
      log.warn("My warn");
    }
  }
</code></pre>

<p>And I need to test it with JMockit like:</p>

<pre><code> @Test
 public void shouldLogWarn(@Mocked Logger log) throws Exception {
   new Expectations() {{
     log.warn(anyString);
   }};
   MyClass my = new MyClass();
   my.foo(); 
 }
</code></pre>

<p>After searching a lot I figured out, I need to use MockUp somehow. But can't get it how exactly.</p>

<p>Btw, I'm using last version of JMockit(1.29) where you no more can <strong>setField(log)</strong> for final static fields.</p>