use of org.apache.sis.metadata.iso.acquisition.DefaultPlatform in project sis by apache.
the class MetadataStandardTest method testEqualsOnCyclicMetadata.
/**
* Tests the {@link MetadataStandard#equals(Object, Object, ComparisonMode)} method on an object
* having cyclic associations. In absence of safety guard against infinite recursivity, this test
* would produce {@link StackOverflowError}.
*/
@Test
@DependsOnMethod("testEquals")
public void testEqualsOnCyclicMetadata() {
final DefaultAcquisitionInformation p1 = createCyclicMetadata();
final DefaultAcquisitionInformation p2 = createCyclicMetadata();
assertTrue("equals", p1.equals(p2));
final DefaultPlatform platform = (DefaultPlatform) getSingleton(p2.getPlatforms());
final DefaultInstrument instrument = (DefaultInstrument) getSingleton(platform.getInstruments());
instrument.setType(new SimpleInternationalString("An other instrument type."));
assertFalse("equals", p1.equals(p2));
}
use of org.apache.sis.metadata.iso.acquisition.DefaultPlatform in project sis by apache.
the class MetadataStandardTest method createCyclicMetadata.
/**
* Creates a metadata object having a cyclic association. The cycle is between
* {@code platform.instrument} and {@code instrument.isMountedOn}.
*/
static DefaultAcquisitionInformation createCyclicMetadata() {
final DefaultInstrument instrument = new DefaultInstrument();
instrument.setType(new SimpleInternationalString("An instrument type."));
final DefaultPlatform platform = new DefaultPlatform();
platform.setDescription(new SimpleInternationalString("A platform."));
instrument.setMountedOn(platform);
platform.setInstruments(singleton(instrument));
final DefaultAcquisitionInformation acquisition = new DefaultAcquisitionInformation();
acquisition.setPlatforms(singleton(platform));
return acquisition;
}
Aggregations