@Test void getFingerprint() throws IOException { String theme = "bootstrap-theme-name.min.css"; String version = "bootstrap-3"; String themeUri = "css/theme/" + version + "/" + theme; FileSystemResource themeFile = mock(FileSystemResource.class); InputStream themeDataStream = IOUtils.toInputStream("yo yo yo data"); when(themeFile.getInputStream()).thenReturn(themeDataStream); when(styleService.getThemeData(theme, BootstrapVersion.BOOTSTRAP_VERSION_3)) .thenReturn(themeFile); String firstResult = themeFingerprintRegistry.getFingerprint(themeUri); assertNotNull(firstResult); verify(styleService).getThemeData(theme, BootstrapVersion.BOOTSTRAP_VERSION_3); String secondResult = themeFingerprintRegistry.getFingerprint(themeUri); verifyNoMoreInteractions(styleService); assertEquals(secondResult, firstResult); }
public String getFingerprint(String themeUri) throws IOException { String fileFingerprint = styleFingerprints.get(themeUri); if (fileFingerprint == null) { fileFingerprint = createFingerprint(themeUri); styleFingerprints.put(themeUri, fileFingerprint); } return fileFingerprint; }
ThemeFingerprintRegistry { public String getFingerprint(String themeUri) throws IOException { String fileFingerprint = styleFingerprints.get(themeUri); if (fileFingerprint == null) { fileFingerprint = createFingerprint(themeUri); styleFingerprints.put(themeUri, fileFingerprint); } return fileFingerprint; } }
ThemeFingerprintRegistry { public String getFingerprint(String themeUri) throws IOException { String fileFingerprint = styleFingerprints.get(themeUri); if (fileFingerprint == null) { fileFingerprint = createFingerprint(themeUri); styleFingerprints.put(themeUri, fileFingerprint); } return fileFingerprint; } ThemeFingerprintRegistry(StyleService styleService); }
ThemeFingerprintRegistry { public String getFingerprint(String themeUri) throws IOException { String fileFingerprint = styleFingerprints.get(themeUri); if (fileFingerprint == null) { fileFingerprint = createFingerprint(themeUri); styleFingerprints.put(themeUri, fileFingerprint); } return fileFingerprint; } ThemeFingerprintRegistry(StyleService styleService); String getFingerprint(String themeUri); }
ThemeFingerprintRegistry { public String getFingerprint(String themeUri) throws IOException { String fileFingerprint = styleFingerprints.get(themeUri); if (fileFingerprint == null) { fileFingerprint = createFingerprint(themeUri); styleFingerprints.put(themeUri, fileFingerprint); } return fileFingerprint; } ThemeFingerprintRegistry(StyleService styleService); String getFingerprint(String themeUri);  }