@Test void addNewTheme() throws GetThemeException { when(styleRepository.findOneById(ArgumentMatchers.eq("bootstrap-yeti.min.css"))) .thenReturn(null); bootstrapThemePopulator.populate(); verify(styleService, times(1)).addStyle(any(), any(), any(), any(), any()); }
private void addNewTheme(Resource bootstrap3Resource, Resource[] bootstrap4Themes) { String bootstrap3FileName = bootstrap3Resource.getFilename(); LOG.debug("Add theme with name {}", bootstrap3FileName); try (InputStream bootstrap3Data = bootstrap3Resource.getInputStream()) { Optional<Resource> bootstrap4Optional = guessMatchingBootstrap4File(bootstrap4Themes, bootstrap3FileName); if (bootstrap4Optional.isPresent()) { Resource bootstrap4resource = bootstrap4Optional.get(); addBootstrap3And4Style(bootstrap3FileName, bootstrap3Data, bootstrap4resource); } else { LOG.debug("No matching bootstrap 4 theme found, falling back to default"); styleService.addStyle(bootstrap3FileName, bootstrap3FileName, bootstrap3Data, null, null); } } catch (Exception e) { LOG.error("error adding new bootstrap themes", e); } }
BootstrapThemePopulator { private void addNewTheme(Resource bootstrap3Resource, Resource[] bootstrap4Themes) { String bootstrap3FileName = bootstrap3Resource.getFilename(); LOG.debug("Add theme with name {}", bootstrap3FileName); try (InputStream bootstrap3Data = bootstrap3Resource.getInputStream()) { Optional<Resource> bootstrap4Optional = guessMatchingBootstrap4File(bootstrap4Themes, bootstrap3FileName); if (bootstrap4Optional.isPresent()) { Resource bootstrap4resource = bootstrap4Optional.get(); addBootstrap3And4Style(bootstrap3FileName, bootstrap3Data, bootstrap4resource); } else { LOG.debug("No matching bootstrap 4 theme found, falling back to default"); styleService.addStyle(bootstrap3FileName, bootstrap3FileName, bootstrap3Data, null, null); } } catch (Exception e) { LOG.error("error adding new bootstrap themes", e); } } }
BootstrapThemePopulator { private void addNewTheme(Resource bootstrap3Resource, Resource[] bootstrap4Themes) { String bootstrap3FileName = bootstrap3Resource.getFilename(); LOG.debug("Add theme with name {}", bootstrap3FileName); try (InputStream bootstrap3Data = bootstrap3Resource.getInputStream()) { Optional<Resource> bootstrap4Optional = guessMatchingBootstrap4File(bootstrap4Themes, bootstrap3FileName); if (bootstrap4Optional.isPresent()) { Resource bootstrap4resource = bootstrap4Optional.get(); addBootstrap3And4Style(bootstrap3FileName, bootstrap3Data, bootstrap4resource); } else { LOG.debug("No matching bootstrap 4 theme found, falling back to default"); styleService.addStyle(bootstrap3FileName, bootstrap3FileName, bootstrap3Data, null, null); } } catch (Exception e) { LOG.error("error adding new bootstrap themes", e); } } BootstrapThemePopulator(StyleService styleService, DataService dataService); }
BootstrapThemePopulator { private void addNewTheme(Resource bootstrap3Resource, Resource[] bootstrap4Themes) { String bootstrap3FileName = bootstrap3Resource.getFilename(); LOG.debug("Add theme with name {}", bootstrap3FileName); try (InputStream bootstrap3Data = bootstrap3Resource.getInputStream()) { Optional<Resource> bootstrap4Optional = guessMatchingBootstrap4File(bootstrap4Themes, bootstrap3FileName); if (bootstrap4Optional.isPresent()) { Resource bootstrap4resource = bootstrap4Optional.get(); addBootstrap3And4Style(bootstrap3FileName, bootstrap3Data, bootstrap4resource); } else { LOG.debug("No matching bootstrap 4 theme found, falling back to default"); styleService.addStyle(bootstrap3FileName, bootstrap3FileName, bootstrap3Data, null, null); } } catch (Exception e) { LOG.error("error adding new bootstrap themes", e); } } BootstrapThemePopulator(StyleService styleService, DataService dataService); void populate(); }
BootstrapThemePopulator { private void addNewTheme(Resource bootstrap3Resource, Resource[] bootstrap4Themes) { String bootstrap3FileName = bootstrap3Resource.getFilename(); LOG.debug("Add theme with name {}", bootstrap3FileName); try (InputStream bootstrap3Data = bootstrap3Resource.getInputStream()) { Optional<Resource> bootstrap4Optional = guessMatchingBootstrap4File(bootstrap4Themes, bootstrap3FileName); if (bootstrap4Optional.isPresent()) { Resource bootstrap4resource = bootstrap4Optional.get(); addBootstrap3And4Style(bootstrap3FileName, bootstrap3Data, bootstrap4resource); } else { LOG.debug("No matching bootstrap 4 theme found, falling back to default"); styleService.addStyle(bootstrap3FileName, bootstrap3FileName, bootstrap3Data, null, null); } } catch (Exception e) { LOG.error("error adding new bootstrap themes", e); } } BootstrapThemePopulator(StyleService styleService, DataService dataService); void populate();  }