@Test public void testWriteToEmptyDir() throws GeneratorException, IOException { Mockito.when(mockDir.exists()).thenReturn(false); underTest.generate(); Mockito.verify(mockDir).mkdirs(); Mockito.verify(mockWriter).writeValue(mockFile, mockModel); }
public void generate() throws GeneratorException { try { SkillModel skillModel = skillModelSupplier.getSkillModel(); if (!destdir.exists()) { destdir.mkdirs(); } for (Locale locale : locales) { File out = getDestFile(locale.toLanguageTag() + ".json"); writer.writeValue(out, renderer.render(skillModel, locale)); } } catch (IOException | RuntimeException ex) { throw new GeneratorException(ex); } }
Generator { public void generate() throws GeneratorException { try { SkillModel skillModel = skillModelSupplier.getSkillModel(); if (!destdir.exists()) { destdir.mkdirs(); } for (Locale locale : locales) { File out = getDestFile(locale.toLanguageTag() + ".json"); writer.writeValue(out, renderer.render(skillModel, locale)); } } catch (IOException | RuntimeException ex) { throw new GeneratorException(ex); } } }
Generator { public void generate() throws GeneratorException { try { SkillModel skillModel = skillModelSupplier.getSkillModel(); if (!destdir.exists()) { destdir.mkdirs(); } for (Locale locale : locales) { File out = getDestFile(locale.toLanguageTag() + ".json"); writer.writeValue(out, renderer.render(skillModel, locale)); } } catch (IOException | RuntimeException ex) { throw new GeneratorException(ex); } } Generator(SkillModelSupplier skillModelSupplier, File destdir, List<Locale> locales);  Generator(ObjectWriter writer, SkillModelRenderer renderer, SkillModelSupplier skillModelSupplier, File destdir, List<Locale> locales); }
Generator { public void generate() throws GeneratorException { try { SkillModel skillModel = skillModelSupplier.getSkillModel(); if (!destdir.exists()) { destdir.mkdirs(); } for (Locale locale : locales) { File out = getDestFile(locale.toLanguageTag() + ".json"); writer.writeValue(out, renderer.render(skillModel, locale)); } } catch (IOException | RuntimeException ex) { throw new GeneratorException(ex); } } Generator(SkillModelSupplier skillModelSupplier, File destdir, List<Locale> locales);  Generator(ObjectWriter writer, SkillModelRenderer renderer, SkillModelSupplier skillModelSupplier, File destdir, List<Locale> locales); void generate(); }
Generator { public void generate() throws GeneratorException { try { SkillModel skillModel = skillModelSupplier.getSkillModel(); if (!destdir.exists()) { destdir.mkdirs(); } for (Locale locale : locales) { File out = getDestFile(locale.toLanguageTag() + ".json"); writer.writeValue(out, renderer.render(skillModel, locale)); } } catch (IOException | RuntimeException ex) { throw new GeneratorException(ex); } } Generator(SkillModelSupplier skillModelSupplier, File destdir, List<Locale> locales);  Generator(ObjectWriter writer, SkillModelRenderer renderer, SkillModelSupplier skillModelSupplier, File destdir, List<Locale> locales); void generate();  }