@Test
@DisplayName("testing handling exceptions when writing module")
void writeModule() throws Exception {

    TypeScriptRenderModel model = new TypeScriptRenderModel(TypeScriptModel.newModelWithDefaultModule());
    ProcessingEnvironment env = mock(ProcessingEnvironment.class);
    Filer filer = mock(Filer.class);
    Messager messager = mock(Messager.class);
    when(env.getMessager()).thenReturn(messager);
    when(filer.createSourceFile(any(),any(),any(),any())).thenThrow(new IOException("mocked IO Error"));
    when(filer.createResource(any(),any(),any())).thenThrow(new IOException("mocked IO Error"));
    when(env.getFiler()).thenReturn(filer);
    ModuleGenerator testee = new ModuleGenerator(model,env);
    testee.writeModule();
    verify(messager).printMessage(any(),any());
}