title: Testing a Spring Batch SkipListener
body: <p>I got a SkipListener configured via xml as follows:</p>
  
  <pre><code>&lt;batch:job id="importPersonsJob" job-repository="jobRepository"&gt;
      &lt;batch:step id="importPersonStep"&gt;
          &lt;batch:tasklet transaction-manager="transactionManager"&gt;
              &lt;batch:chunk reader="personItemReader" writer="personItemWriter"
                  commit-interval="5" skip-limit="10"&gt;
                  &lt;batch:skippable-exception-classes&gt;
                      &lt;batch:include class="java.lang.Throwable" /&gt;
                  &lt;/batch:skippable-exception-classes&gt;
              &lt;/batch:chunk&gt;
              &lt;batch:listeners&gt;
                  &lt;batch:listener ref="skipListener" /&gt;
              &lt;/batch:listeners&gt;
          &lt;/batch:tasklet&gt;
      &lt;/batch:step&gt;
      &lt;batch:listeners&gt;
          &lt;batch:listener ref="authenticationJobListener" /&gt;
          &lt;batch:listener ref="jobListener" /&gt;
      &lt;/batch:listeners&gt;
  &lt;/batch:job&gt;
  </code></pre>
  
  <p>The implementation of my SkipListener looks like the following:</p>
  
  <pre><code>public class SkipListener {
      @OnSkipInRead
      public void log(final Throwable throwable) throws IOException {
          // make something
      }
  
      @OnSkipInWrite
      public void log(final Object objectToWrite, final Throwable throwable) throws IOException {
          // make something
      }
  
      // some dependencies
  }
  </code></pre>
  
  <p>I already asked google how to test this efficiently. Sadly it wasn't so effective. Maybe you can give me a brief hint of how to achieve this.</p>