Search in sources :

Example 1 with TestStep

use of org.apache.sis.test.TestStep in project sis by apache.

the class FranceGeocentricInterpolationTest method testGridAsFloats.

/**
 * Tests a small grid file with interpolations in geocentric coordinates as {@code float} values.
 *
 * <p>This method is part of a chain.
 * The next method is {@link #testGridAsShorts(DatumShiftGridFile)}.</p>
 *
 * @return the loaded grid with values as {@code float}.
 * @throws URISyntaxException if the URL to the test file can not be converted to a path.
 * @throws IOException if an error occurred while loading the grid.
 * @throws FactoryException if an error occurred while computing the grid.
 * @throws TransformException if an error occurred while computing the envelope.
 */
@TestStep
private static DatumShiftGridFile<Angle, Length> testGridAsFloats() throws URISyntaxException, IOException, FactoryException, TransformException {
    final Path file = getResource(TEST_FILE);
    final DatumShiftGridFile.Float<Angle, Length> grid;
    try (BufferedReader in = Files.newBufferedReader(file)) {
        grid = FranceGeocentricInterpolation.load(in, file);
    }
    assertEquals("cellPrecision", 0.005, grid.getCellPrecision(), STRICT);
    assertEquals("getCellMean", 168.2587, grid.getCellMean(0), 0.0001);
    assertEquals("getCellMean", 58.7163, grid.getCellMean(1), 0.0001);
    assertEquals("getCellMean", -320.1801, grid.getCellMean(2), 0.0001);
    verifyGrid(grid);
    return grid;
}
Also used : Path(java.nio.file.Path) Angle(javax.measure.quantity.Angle) Length(javax.measure.quantity.Length) BufferedReader(java.io.BufferedReader) TestStep(org.apache.sis.test.TestStep)

Example 2 with TestStep

use of org.apache.sis.test.TestStep in project sis by apache.

the class MetadataSourceTest method testSearch.

/**
 * Tests {@link MetadataSource#search(Object)}
 *
 * @param  source  the instance to test.
 * @throws MetadataStoreException if an error occurred while querying the database.
 */
@TestStep
public static void testSearch(final MetadataSource source) throws MetadataStoreException {
    final DefaultCitation specification = new DefaultCitation("PNG (Portable Network Graphics) Specification");
    specification.setAlternateTitles(Collections.singleton(new SimpleInternationalString("PNG")));
    final DefaultFormat format = new DefaultFormat();
    format.setFormatSpecificationCitation(specification);
    assertEquals("PNG", source.search(format));
    specification.setTitle(null);
    assertNull(source.search(format));
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) SimpleInternationalString(org.apache.sis.util.iso.SimpleInternationalString) DefaultFormat(org.apache.sis.metadata.iso.distribution.DefaultFormat) TestStep(org.apache.sis.test.TestStep)

Aggregations

TestStep (org.apache.sis.test.TestStep)2 BufferedReader (java.io.BufferedReader)1 Path (java.nio.file.Path)1 Angle (javax.measure.quantity.Angle)1 Length (javax.measure.quantity.Length)1 DefaultCitation (org.apache.sis.metadata.iso.citation.DefaultCitation)1 DefaultFormat (org.apache.sis.metadata.iso.distribution.DefaultFormat)1 SimpleInternationalString (org.apache.sis.util.iso.SimpleInternationalString)1