@Test
public void shouldFailToExport() throws IOException {

  Writer writer = Mockito.mock(Writer.class);
  Mockito.when(writer.append(Matchers.any(CharSequence.class))).thenThrow(new IOException());
  exporter = new CodeNarcProfileExporter(writer);
  try {
    exporter.exportProfile(profile);
    Fail.fail("Should have failed");
  }  catch(IllegalStateException e) {
    assertThat(e.getMessage()).contains("Fail to export CodeNarc profile");
  }
}