title: How to test a method using a PrintWriter?
body: <p>I have following method:</p>
  
  <pre><code>@Component
  public class WriteCsvToResponse {
  
      private static final Logger LOGGER = LoggerFactory.getLogger(WriteCsvToResponse.class);
  
      public void writeStatus(PrintWriter writer, Status status) {
  
          try {
  
              ColumnPositionMappingStrategy mapStrategy
                  = new ColumnPositionMappingStrategy();
  
              mapStrategy.setType(Status.class);
  
              String[] columns = new String[]{"id", "storeId", "status"};
              mapStrategy.setColumnMapping(columns);
  
              StatefulBeanToCsv btcsv = new StatefulBeanToCsvBuilder(writer)
                  .withQuotechar(CSVWriter.NO_QUOTE_CHARACTER)
                  .withMappingStrategy(mapStrategy)
                  .withSeparator(',')
                  .build();
  
              btcsv.write(status);
  
          } catch (CsvException ex) {
  
              LOGGER.error("Error mapping Bean to CSV", ex);
          }
      }
  </code></pre>
  
  <p>I have no idea how to test it properly using <code>mockito</code>. </p>
  
  <p>Use it to wrap the object status into <code>csv</code> format.
  I used StringWriter to wrap the response in it. 
  There are no more details left, but it seems I have to create some words to pass the validation :)</p>