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());
}
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());
}
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());
}
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());
}
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);
}
Aggregations