### Question:
ImageUtil { public static void toFile(String oldFile, String newFile, ImageParamDTO params) throws IOException { if (StringUtils.isBlank(oldFile) || StringUtils.isBlank(newFile)) { logger.error("原文件名或目标文件名为空"); return; } Thumbnails.Builder builder = Thumbnails.of(oldFile); fillBuilderWithParams(builder, params); if (null == builder) { return; } builder.toFile(newFile); }  static void toFile(String oldFile, String newFile, ImageParamDTO params); static BufferedImage toBufferedImage(String oldFile, ImageParamDTO params); static OutputStream toOutputStream(InputStream input, OutputStream output, ImageParamDTO params); static String getContentType(byte[] content); static final InputStream bytes2InputStream(byte[] buf); static final byte[] inputStream2bytes(InputStream inStream);  }### Answer:
@Test public void testToFile() throws IOException { final String oldFile = System.getProperty("user.dir") + "/src/test/resources/images/lion2.jpg"; final String newFile = System.getProperty("user.dir") + "/src/test/resources/images/lion2_watermark"; final String warterFile = System.getProperty("user.dir") + "/src/test/resources/images/wartermark.png"; ImageParamDTO params = new ImageParamDTO(); params.setFormat("png"); params.setWaterMark(new ImageParamDTO.WaterMark(9, warterFile, 0.6f)); ImageUtil.toFile(oldFile, newFile, params); }