FileTypeService { public boolean isPDF(byte[] data) { return isDataTypeEqualTo(data, "application/pdf"); }  String getType(byte[] data); boolean isPDF(byte[] data);  }
@Test public void shouldCheckIfFileTypeIsPDF() throws Exception { FileTypeService service = new FileTypeService(); File file = new File(getClass().getClassLoader().getResource("pdfexample.pdf").getPath()); byte[] bytes = convertFileToBytes(file); assertThat(service.isPDF(bytes), equalTo(true)); }