Embedding { public String getFileEnding() { switch (mimeType) { case PNG: case GIF: case BMP: case JPG: case JPEG: case HTML: case XML: case JSON: case APPLICATION_XML: return mimeType.getContentType().substring(mimeType.getContentType().indexOf('/') + 1); case SVG: case SVG_XML: return "svg"; case TXT: return "txt"; case PDF: return "pdf"; default: return "unknown"; } }  String getData(); void setData(final String data); String getDecodedData(); void decodeData(final String data); MimeType getMimeType(); void setMimeType(final MimeType mimeType); String getName(); void setName(final String name); String getFilename(); void setFilename(final String filename); boolean isImage(); boolean isPlainText(); String getFileEnding(); boolean isExternalContent();  }
@Test public void getFileEndingTest() { embedding.setMimeType(MimeType.PNG); assertThat(embedding.getFileEnding(), is("png")); embedding.setMimeType(MimeType.GIF); assertThat(embedding.getFileEnding(), is("gif")); embedding.setMimeType(MimeType.BMP); assertThat(embedding.getFileEnding(), is("bmp")); embedding.setMimeType(MimeType.JPEG); assertThat(embedding.getFileEnding(), is("jpeg")); embedding.setMimeType(MimeType.HTML); assertThat(embedding.getFileEnding(), is("html")); embedding.setMimeType(MimeType.XML); assertThat(embedding.getFileEnding(), is("xml")); embedding.setMimeType(MimeType.JSON); assertThat(embedding.getFileEnding(), is("json")); embedding.setMimeType(MimeType.APPLICATION_XML); assertThat(embedding.getFileEnding(), is("xml")); embedding.setMimeType(MimeType.SVG); assertThat(embedding.getFileEnding(), is("svg")); embedding.setMimeType(MimeType.SVG_XML); assertThat(embedding.getFileEnding(), is("svg")); embedding.setMimeType(MimeType.TXT); assertThat(embedding.getFileEnding(), is("txt")); embedding.setMimeType(MimeType.PDF); assertThat(embedding.getFileEnding(), is("pdf")); embedding.setMimeType(MimeType.UNKNOWN); assertThat(embedding.getFileEnding(), is("unknown")); }