### Question:
JP2ProductWriterPlugIn implements ProductWriterPlugIn { @Override public EncodeQualification getEncodeQualification(Product product) { GeoCoding geoCoding = product.getSceneGeoCoding(); if (geoCoding == null) { return new EncodeQualification(EncodeQualification.Preservation.PARTIAL, "The product is not geo-coded. A usual JP2 file will be written instead."); } else if (!(geoCoding instanceof CrsGeoCoding)) { return new EncodeQualification(EncodeQualification.Preservation.PARTIAL, "The product is geo-coded but seems not rectified. Geo-coding information may not be properly preserved."); } else if (product.isMultiSize()) { return new EncodeQualification(EncodeQualification.Preservation.UNABLE, "Cannot write multisize products. Consider resampling the product first."); } else { return new EncodeQualification(EncodeQualification.Preservation.FULL); } }  @Override EncodeQualification getEncodeQualification(Product product); @Override Class[] getOutputTypes(); @Override ProductWriter createWriterInstance(); @Override String[] getFormatNames(); @Override String[] getDefaultFileExtensions(); @Override String getDescription(Locale locale); @Override SnapFileFilter getProductFileFilter();  }### Answer:
@Test public void testEncodingQualification() throws Exception { Product product = new Product("Name", "JP2", 4, 4); EncodeQualification encodeQualification = plugIn.getEncodeQualification(product); assertNotNull(encodeQualification); assertEquals(EncodeQualification.Preservation.PARTIAL, encodeQualification.getPreservation()); assertNotNull(encodeQualification.getInfoString()); TiePointGrid lat = new TiePointGrid("lat", 4, 4, 0, 0, 1, 1, new float[16]); TiePointGrid lon = new TiePointGrid("lon", 4, 4, 0, 0, 1, 1, new float[16]); product.addTiePointGrid(lat); product.addTiePointGrid(lon); product.setSceneGeoCoding(new TiePointGeoCoding(lat, lon)); encodeQualification = plugIn.getEncodeQualification(product); assertEquals(EncodeQualification.Preservation.PARTIAL, encodeQualification.getPreservation()); assertNotNull(encodeQualification.getInfoString()); product.setSceneGeoCoding(new CrsGeoCoding(DefaultGeographicCRS.WGS84, 4, 4, 0, 0, 1, 1)); encodeQualification = plugIn.getEncodeQualification(product); assertEquals(EncodeQualification.Preservation.FULL, encodeQualification.getPreservation()); }