### Question:
OpenJp2ImageWriter extends ImageWriter { @Override public ImageWriteParam getDefaultWriteParam() { return new OpenJp2ImageWriteParam(); } protected  OpenJp2ImageWriter(ImageWriterSpi originatingProvider, OpenJpeg lib); @Override void setOutput(Object output); @Override ImageWriteParam getDefaultWriteParam(); @Override IIOMetadata getDefaultStreamMetadata(ImageWriteParam param); @Override IIOMetadata getDefaultImageMetadata(ImageTypeSpecifier imageType, ImageWriteParam param); @Override IIOMetadata convertStreamMetadata(IIOMetadata inData, ImageWriteParam param); @Override IIOMetadata convertImageMetadata(
      IIOMetadata inData, ImageTypeSpecifier imageType, ImageWriteParam param); @Override void write(IIOMetadata streamMetadata, IIOImage image, ImageWriteParam param);  }### Answer:
@Test void writeLosslessUntiled() throws Exception { OpenJp2ImageWriteParam param = (OpenJp2ImageWriteParam) writer.getDefaultWriteParam(); compressAndCompare("lenna_defaults.jp2", param); }
@Test void writeLossyUntiledDefaultQuality() throws Exception { OpenJp2ImageWriteParam param = (OpenJp2ImageWriteParam) writer.getDefaultWriteParam(); param.setCompressionType("lossy"); compressAndCompare("lenna_lossy.jp2", param); }
@Test void writeLossyUntiledCustomQuality() throws Exception { OpenJp2ImageWriteParam param = (OpenJp2ImageWriteParam) writer.getDefaultWriteParam(); param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); param.setCompressionQuality(0.9f); compressAndCompare("lenna_lossy_r10.jp2", param); }
@Test void writeLossyTiledCustomQuality() throws Exception { OpenJp2ImageWriteParam param = (OpenJp2ImageWriteParam) writer.getDefaultWriteParam(); param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); param.setCompressionQuality(0.9f); param.setTilingMode(ImageWriteParam.MODE_EXPLICIT); param.setTiling(128, 128, 0, 0); compressAndCompare("lenna_tiled_lossy_r10.jp2", param); }