public void test_loading_binary() { // ## Arrange ## WhiteBinaryCB cb = new WhiteBinaryCB(); cb.query().addOrderBy_BinaryId_Asc(); cb.fetchFirst(1); // ## Act ## WhiteBinary binary = whiteBinaryBhv.selectEntityWithDeletedCheck(cb); // ## Assert ## byte[] blobData = binary.getBlobData(); assertNotNull(blobData); FileOutputStream fos = null; try { final File buildDir = DfResourceUtil.getBuildDir(getClass()); final String path = buildDir.getAbsolutePath() + "/../loaded.jpg"; final File outputFile = new File(path); if (outputFile.exists()) { outputFile.delete(); } log("outputFile=" + outputFile); fos = new FileOutputStream(outputFile); fos.write(blobData); // and after that, check it by your eyes } catch (IOException e) { throw new IllegalStateException(e); } finally { if (fos != null) { try { fos.close(); } catch (IOException ignored) { } } } }