Search in sources :

Example 66 with DependsOnMethod

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

the class PrunerTest method testPrune.

/**
 * Tests the {@link ModifiableMetadata#prune()} method.
 */
@Test
@DependsOnMethod("testIsEmpty")
public void testPrune() {
    metadata.setMetadataIdentifier(new SimpleIdentifier(null, "A file identifiers", false));
    identification.setCitation(new DefaultCitation("A citation title"));
    assertFalse(isNullOrEmpty(metadata.getMetadataIdentifier()));
    assertFalse(isNullOrEmpty(identification.getCitation()));
    assertEquals(1, metadata.getIdentificationInfo().size());
    assertEquals(1, identification.getExtents().size());
    assertEquals(1, extent.getGeographicElements().size());
    assertFalse(metadata.isEmpty());
    metadata.prune();
    assertFalse(isNullOrEmpty(metadata.getMetadataIdentifier()));
    assertFalse(isNullOrEmpty(identification.getCitation()));
    assertEquals(1, metadata.getIdentificationInfo().size());
    assertEquals(0, identification.getExtents().size());
    assertEquals(0, extent.getGeographicElements().size());
    assertFalse(metadata.isEmpty());
    metadata.setMetadataIdentifier(new SimpleIdentifier(null, " ", false));
    identification.setCitation(new DefaultCitation(" "));
    assertNotNull(metadata.getMetadataIdentifier());
    metadata.prune();
    assertNull(metadata.getMetadataIdentifier());
    assertNull(identification.getCitation());
    assertTrue(metadata.getIdentificationInfo().isEmpty());
    assertTrue(identification.getExtents().isEmpty());
    assertTrue(extent.getGeographicElements().isEmpty());
    assertTrue(metadata.isEmpty());
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) SimpleIdentifier(org.apache.sis.internal.simple.SimpleIdentifier) Test(org.junit.Test) DependsOnMethod(org.apache.sis.test.DependsOnMethod)

Example 67 with DependsOnMethod

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

the class SpecialCasesTest method testSet.

/**
 * Tests {@link SpecialCases#set(int, Object, Object, int)} in {@code RETURN_PREVIOUS} mode.
 */
@Test
@DependsOnMethod("testGet")
public void testSet() {
    createBox();
    assertPreviousEquals("westBoundLongitude", new Longitude(-20), new Longitude(-15));
    assertPreviousEquals("eastBoundLongitude", new Longitude(30), new Longitude(25));
    assertPreviousEquals("southBoundLatitude", new Latitude(-10), new Latitude(-5));
    assertPreviousEquals("northBoundLatitude", new Latitude(40), new Latitude(35));
    assertPreviousEquals("extentTypeCode", Boolean.TRUE, Boolean.FALSE);
    assertEquals("westBoundLongitude", -15, box.getWestBoundLongitude(), STRICT);
    assertEquals("eastBoundLongitude", 25, box.getEastBoundLongitude(), STRICT);
    assertEquals("southBoundLatitude", -5, box.getSouthBoundLatitude(), STRICT);
    assertEquals("northBoundLatitude", 35, box.getNorthBoundLatitude(), STRICT);
    assertEquals("extentTypeCode", Boolean.FALSE, box.getInclusion());
}
Also used : Latitude(org.apache.sis.measure.Latitude) Longitude(org.apache.sis.measure.Longitude) Test(org.junit.Test) DependsOnMethod(org.apache.sis.test.DependsOnMethod)

Example 68 with DependsOnMethod

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

the class SpecialCasesTest method testAppend.

/**
 * Tests {@link SpecialCases#set(int, Object, Object, int)} in {@code APPEND} mode.
 */
@Test
@DependsOnMethod("testSet")
public void testAppend() {
    createBox();
    assertAppendResultEquals("westBoundLongitude", null, new Longitude(-20));
    assertAppendResultEquals("eastBoundLongitude", null, new Longitude(24));
    assertAppendResultEquals("southBoundLatitude", null, new Latitude(-6));
    assertAppendResultEquals("northBoundLatitude", null, 40.0);
    assertAppendResultEquals("extentTypeCode", false, Boolean.TRUE);
    assertEquals("westBoundLongitude", -20, box.getWestBoundLongitude(), STRICT);
    assertEquals("eastBoundLongitude", 30, box.getEastBoundLongitude(), STRICT);
    assertEquals("southBoundLatitude", -10, box.getSouthBoundLatitude(), STRICT);
    assertEquals("northBoundLatitude", 40, box.getNorthBoundLatitude(), STRICT);
    assertEquals("extentTypeCode", Boolean.TRUE, box.getInclusion());
}
Also used : Latitude(org.apache.sis.measure.Latitude) Longitude(org.apache.sis.measure.Longitude) Test(org.junit.Test) DependsOnMethod(org.apache.sis.test.DependsOnMethod)

Example 69 with DependsOnMethod

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

the class SpecialCasesTest method testSetAsPrimitive.

/**
 * Tests {@link SpecialCases#set(int, Object, Object, int)} in {@code RETURN_PREVIOUS} mode
 * with {@link Double} values instead than {@link Longitude} or {@link Latitude}.
 */
@Test
@DependsOnMethod("testSet")
public void testSetAsPrimitive() {
    createBox();
    assertPreviousEquals("westBoundLongitude", new Longitude(-20), -14.0);
    assertPreviousEquals("eastBoundLongitude", new Longitude(30), 26);
    assertPreviousEquals("southBoundLatitude", new Latitude(-10), -7f);
    assertPreviousEquals("northBoundLatitude", new Latitude(40), (short) 33);
    assertEquals("westBoundLongitude", -14, box.getWestBoundLongitude(), STRICT);
    assertEquals("eastBoundLongitude", 26, box.getEastBoundLongitude(), STRICT);
    assertEquals("southBoundLatitude", -7, box.getSouthBoundLatitude(), STRICT);
    assertEquals("northBoundLatitude", 33, box.getNorthBoundLatitude(), STRICT);
    assertEquals("extentTypeCode", Boolean.TRUE, box.getInclusion());
}
Also used : Latitude(org.apache.sis.measure.Latitude) Longitude(org.apache.sis.measure.Longitude) Test(org.junit.Test) DependsOnMethod(org.apache.sis.test.DependsOnMethod)

Example 70 with DependsOnMethod

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

the class TreeNodeChildrenTest method testRemoveWithSingletonInCollections.

/**
 * Tests the {@link Iterator#remove()} operation on a list of properties with
 * collections containing only one element.
 */
@Test
@DependsOnMethod({ "testRemoveWithoutCollections", "testReadOnlyWithSingletonInCollections" })
public void testRemoveWithSingletonInCollections() {
    final DefaultCitation citation = metadataWithSingletonInCollections();
    final TreeNodeChildren children = create(citation, ValueExistencePolicy.NON_EMPTY);
    assertEquals("titleProperty", -1, children.titleProperty);
    testRemove(TestUtilities.createRandomNumberGenerator(), children);
}
Also used : DefaultCitation(org.apache.sis.metadata.iso.citation.DefaultCitation) Test(org.junit.Test) DependsOnMethod(org.apache.sis.test.DependsOnMethod)

Aggregations

DependsOnMethod (org.apache.sis.test.DependsOnMethod)298 Test (org.junit.Test)296 ParameterValueGroup (org.opengis.parameter.ParameterValueGroup)27 ProjectedCRS (org.opengis.referencing.crs.ProjectedCRS)23 DefaultCitation (org.apache.sis.metadata.iso.citation.DefaultCitation)21 CoordinateOperation (org.opengis.referencing.operation.CoordinateOperation)21 Rectangle (java.awt.Rectangle)19 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)19 SimpleInternationalString (org.apache.sis.util.iso.SimpleInternationalString)18 GeographicCRS (org.opengis.referencing.crs.GeographicCRS)15 Random (java.util.Random)11 Matrix (org.opengis.referencing.operation.Matrix)11 HashMap (java.util.HashMap)10 IdentifiedObject (org.opengis.referencing.IdentifiedObject)8 ReferenceIdentifier (org.opengis.referencing.ReferenceIdentifier)8 MathTransform (org.opengis.referencing.operation.MathTransform)8 DefaultFeatureType (org.apache.sis.feature.DefaultFeatureType)7 DefaultFeatureTypeTest (org.apache.sis.feature.DefaultFeatureTypeTest)7 DirectPosition2D (org.apache.sis.geometry.DirectPosition2D)7 GeneralParameterDescriptor (org.opengis.parameter.GeneralParameterDescriptor)7