use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class CommonCRSTest method testSpherical.
/**
* Tests the {@link CommonCRS#spherical()} method.
*/
@Test
@DependsOnMethod("testGeographic3D")
public void testSpherical() {
final GeocentricCRS crs = CommonCRS.ETRS89.spherical();
Validators.validate(crs);
assertEquals("ETRS89", crs.getName().getCode());
assertSame(CommonCRS.ETRS89.geographic().getDatum(), crs.getDatum());
assertNotSame(CommonCRS.WGS84.geographic().getDatum(), crs.getDatum());
final CoordinateSystem cs = crs.getCoordinateSystem();
final String name = cs.getName().getCode();
assertTrue(name, name.startsWith("Spherical"));
assertEquals("dimension", 3, cs.getDimension());
assertAxisDirectionsEqual(name, cs, AxisDirection.NORTH, AxisDirection.EAST, AxisDirection.UP);
assertSame("Cached value", crs, CommonCRS.ETRS89.spherical());
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class CommonCRSTest method testGeocentric.
/**
* Tests the {@link CommonCRS#geocentric()} method.
*/
@Test
@DependsOnMethod("testGeographic3D")
public void testGeocentric() {
final GeocentricCRS crs = CommonCRS.WGS72.geocentric();
Validators.validate(crs);
assertEquals("WGS 72", crs.getName().getCode());
assertSame(CommonCRS.WGS72.geographic().getDatum(), crs.getDatum());
assertNotSame(CommonCRS.WGS84.geographic().getDatum(), crs.getDatum());
final CoordinateSystem cs = crs.getCoordinateSystem();
final String name = cs.getName().getCode();
assertTrue(name, name.startsWith("Earth centred"));
assertEquals("dimension", 3, cs.getDimension());
assertAxisDirectionsEqual(name, cs, AxisDirection.GEOCENTRIC_X, AxisDirection.GEOCENTRIC_Y, AxisDirection.GEOCENTRIC_Z);
assertSame("Cached value", crs, CommonCRS.WGS72.geocentric());
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class CommonCRSTest method testGeographic3D.
/**
* Tests the {@link CommonCRS#geographic3D()} method.
*/
@Test
@DependsOnMethod("testGeographic")
public void testGeographic3D() {
final GeographicCRS crs = CommonCRS.WGS72.geographic3D();
Validators.validate(crs);
assertEquals("WGS 72", crs.getName().getCode());
assertSame(CommonCRS.WGS72.geographic().getDatum(), crs.getDatum());
assertNotSame(CommonCRS.WGS84.geographic().getDatum(), crs.getDatum());
final EllipsoidalCS cs = crs.getCoordinateSystem();
final String name = cs.getName().getCode();
assertTrue(name, name.startsWith("Ellipsoidal 3D"));
assertEquals("dimension", 3, cs.getDimension());
assertAxisDirectionsEqual(name, cs, AxisDirection.NORTH, AxisDirection.EAST, AxisDirection.UP);
assertSame("Cached value", crs, CommonCRS.WGS72.geographic3D());
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class CC_GeneralOperationParameterTest method testGroupMergeBecauseDifferentProperties.
/**
* Tests case where the unmarshalled parameter group needs to be merged with the complete parameter group.
* The reason for the group merge in this test is because the unmarshalled parameters have different remarks
* or different obligation.
*
* @throws JAXBException if this method failed to create test data.
*/
@Test
@DependsOnMethod({ "testGroupSubstitution", "testParameterMerge" })
public void testGroupMergeBecauseDifferentProperties() throws JAXBException {
final Map<String, String> properties = new HashMap<>(4);
assertNull(properties.put(DefaultParameterDescriptor.NAME_KEY, "Group"));
final ParameterDescriptorGroup provided = new DefaultParameterDescriptorGroup(properties, 1, 2, unmarshal("Parameter A", "Remarks A."), unmarshal("Parameter B", "Remarks B."), unmarshal("Parameter C", "Remarks C."));
assertNull(properties.put(DefaultParameterDescriptor.REMARKS_KEY, "More details here."));
final ParameterDescriptorGroup complete = new DefaultParameterDescriptorGroup(properties, 1, 2, create("Parameter A", "Remarks A.", true, 3), create("Parameter B", "Remarks B.", false, 4), create("Parameter C", "Different.", false, 5), create("Parameter D", "Remarks D.", false, 6));
final ParameterDescriptorGroup merged = (ParameterDescriptorGroup) CC_GeneralOperationParameter.merge(provided, complete);
assertNotSame(complete, provided);
assertSame("name", complete.getName(), merged.getName());
assertSame("remarks", complete.getRemarks(), merged.getRemarks());
assertEquals("minimumOccurs", 1, merged.getMinimumOccurs());
assertEquals("maximumOccurs", 2, merged.getMaximumOccurs());
final Iterator<GeneralParameterDescriptor> itc = complete.descriptors().iterator();
final Iterator<GeneralParameterDescriptor> itm = merged.descriptors().iterator();
// Not same because different obligation.
verifyParameter(itc.next(), itm.next(), false, "Remarks A.");
// Same ParameterDescriptor instance.
verifyParameter(itc.next(), itm.next(), true, "Remarks B.");
// Not same because different remarks.
verifyParameter(itc.next(), itm.next(), false, "Remarks C.");
assertTrue("Missing descriptor.", itc.hasNext());
assertFalse("Unexpected descriptor.", itm.hasNext());
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class CC_GeneralOperationParameterTest method testGroupMergeBecauseExtraParameter.
/**
* Tests case where the unmarshalled parameter group needs to be merged with the complete parameter group.
* The reason for the group merge in this test is because the unmarshalled parameters have a parameter not
* present in the "complete" group.
*
* @throws JAXBException if this method failed to create test data.
*/
@Test
@DependsOnMethod("testGroupMergeBecauseDifferentProperties")
public void testGroupMergeBecauseExtraParameter() throws JAXBException {
final Map<String, String> properties = new HashMap<>(4);
assertNull(properties.put(DefaultParameterDescriptor.NAME_KEY, "Group"));
final ParameterDescriptorGroup provided = new DefaultParameterDescriptorGroup(properties, 1, 2, unmarshal("Parameter A", "Remarks A."), unmarshal("Parameter B", "Remarks B."), unmarshal("Parameter C", "Remarks C."));
assertNull(properties.put(DefaultParameterDescriptor.REMARKS_KEY, "More details here."));
final ParameterDescriptorGroup complete = new DefaultParameterDescriptorGroup(properties, 1, 2, create("Parameter A", "Remarks A.", false, 3), create("Parameter C", "Remarks C.", false, 4));
loggings.assertNoUnexpectedLog();
final ParameterDescriptorGroup merged = (ParameterDescriptorGroup) CC_GeneralOperationParameter.merge(provided, complete);
assertNotSame(complete, provided);
assertSame("name", complete.getName(), merged.getName());
assertSame("remarks", complete.getRemarks(), merged.getRemarks());
assertEquals("minimumOccurs", 1, merged.getMinimumOccurs());
assertEquals("maximumOccurs", 2, merged.getMaximumOccurs());
loggings.assertNextLogContains("Parameter B", "Group");
loggings.assertNoUnexpectedLog();
final Iterator<GeneralParameterDescriptor> itc = complete.descriptors().iterator();
final Iterator<GeneralParameterDescriptor> itm = merged.descriptors().iterator();
verifyParameter(itc.next(), itm.next(), true, "Remarks A.");
final GeneralParameterDescriptor extra = itm.next();
assertEquals("name", "Parameter B", extra.getName().getCode());
assertEquals("remark", "Remarks B.", extra.getRemarks().toString());
verifyParameter(itc.next(), itm.next(), true, "Remarks C.");
assertFalse("Unexpected descriptor.", itc.hasNext());
assertFalse("Unexpected descriptor.", itm.hasNext());
}
Aggregations