@Test public void testGetIconStyleReturnsDefaultValueIfMimeTypeHasNoIconAssigned() throws Exception { // GIVEN // WHEN String icon = MIMEMapping.getMIMETypeIconStyle(MIME_TYPE_HTML); // THEN assertThat(icon, equalTo(MIMEMapping.DEFAULT_ICON_STYLE)); }
@Test public void testGetIconStyleReturnsCorrectIconStyle1() throws Exception { // GIVEN // WHEN String icon = MIMEMapping.getMIMETypeIconStyle(MIME_TYPE_PNG); // THEN assertThat(icon, equalTo(ICON_STYLE_PNG)); }
@Test public void testGetIconStyleReturnsCorrectIconStyle2() throws Exception { // GIVEN // WHEN // icon for this particular type is not set, but "parent" mime-type is set for all videos and it uses icon-file-video String icon = MIMEMapping.getMIMETypeIconStyle(MIME_TYPE_VIDEO_QUICKTIME); // THEN assertThat(icon, equalTo(ICON_STYLE_VIDEO)); }
private String getIcon(Node node) throws RepositoryException { String mimeType = getMimeType(node); if (definition.isThumbnails() && isImage(mimeType) && !MediaType.SVG_UTF_8.is(MediaType.parse(mimeType))) { return getThumbnail(JcrItemUtil.getItemId(node)); } if (isAssetNode(node)) { return String.format(ICON_TAG, MIMEMapping.getMIMETypeIconStyle(mimeType)); } return EMPTY; }