WidgetImporter extends ComponentDependencyImporter<Widget> { @Override public List<Widget> load(Identifiable parent, Path resources) throws IOException { Path widgetsPath = resources.resolve("widgets"); if (Files.exists(widgetsPath)) { return widgetLoader.loadAllCustom(widgetsPath); } return new ArrayList<>(); } WidgetImporter(WidgetFileBasedLoader widgetLoader, WidgetRepository widgetRepository, AssetImporter<Widget> widgetAssetImporter); @Override List<Widget> load(Identifiable parent, Path resources); @Override void save(List<Widget> elements, Path resources);  }
@Test public void should_load_custom_widgets() throws Exception { File widgetsFolder = temporaryFolder.newFolder("widgets"); widgetImporter.load(null, temporaryFolder.toPath()); verify(widgetLoader).loadAllCustom(widgetsFolder.toPath()); }