use of org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeatureComplex in project arctic-sea by 52North.
the class SamplingFeatureComplexTest method should_set_relatedSamplingFeature_correct.
@Test
public void should_set_relatedSamplingFeature_correct() {
final SamplingFeature feature = new SamplingFeature(new CodeWithAuthority("test-feature"));
final SamplingFeatureComplex sfc = new SamplingFeatureComplex("test-role", feature);
assertThat(sfc.getRelatedSamplingFeature(), is(feature));
}
use of org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeatureComplex in project arctic-sea by 52North.
the class SamplingFeatureTest method addRelatedSamplingFeature_should_add_a_relatedSamplingFeature.
@Test
public final void addRelatedSamplingFeature_should_add_a_relatedSamplingFeature() {
final SamplingFeature feature = new SamplingFeature(null);
final SamplingFeatureComplex relatedSamplingFeature = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature")));
feature.addRelatedSamplingFeature(relatedSamplingFeature);
assertThat(feature.isSetRelatedSamplingFeatures(), is(TRUE));
assertThat(feature.getRelatedSamplingFeatures(), hasSize(1));
assertThat(feature.getRelatedSamplingFeatures().get(0), is(relatedSamplingFeature));
final SamplingFeatureComplex relatedSamplingFeature2 = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature-2")));
feature.addRelatedSamplingFeature(relatedSamplingFeature2);
validate(feature, relatedSamplingFeature, relatedSamplingFeature2);
feature.addRelatedSamplingFeature(null);
validate(feature, relatedSamplingFeature, relatedSamplingFeature2);
}
use of org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeatureComplex in project arctic-sea by 52North.
the class SamplingFeatureTest method validate.
private void validate(final SamplingFeature feature, final SamplingFeatureComplex... relatedSamplingFeatures) {
assertThat(feature.isSetRelatedSamplingFeatures(), is(TRUE));
assertThat(feature.getRelatedSamplingFeatures(), hasSize(relatedSamplingFeatures.length));
for (final SamplingFeatureComplex relatedSamplingFeature : relatedSamplingFeatures) {
assertThat(feature.getRelatedSamplingFeatures(), hasItem(relatedSamplingFeature));
}
}
use of org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeatureComplex in project arctic-sea by 52North.
the class SamplingFeatureTest method addAllRelatedSamplingFeatures_should_add_all_elements.
@Test
public final void addAllRelatedSamplingFeatures_should_add_all_elements() {
final SamplingFeature feature = new SamplingFeature(null);
final SamplingFeatureComplex relatedSamplingFeature = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature")));
final SamplingFeatureComplex relatedSamplingFeature2 = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature-2")));
List<SamplingFeatureComplex> list = Lists.newArrayList(relatedSamplingFeature, relatedSamplingFeature2);
feature.addAllRelatedSamplingFeatures(list);
validate(feature, relatedSamplingFeature, relatedSamplingFeature2);
final SamplingFeatureComplex relatedSamplingFeature3 = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature-3")));
final SamplingFeatureComplex relatedSamplingFeature4 = new SamplingFeatureComplex("test-role", new SamplingFeature(new CodeWithAuthority("test-feature-4")));
list = Lists.newArrayList(relatedSamplingFeature3, relatedSamplingFeature4);
feature.addAllRelatedSamplingFeatures(list);
validate(feature, relatedSamplingFeature, relatedSamplingFeature2, relatedSamplingFeature3, relatedSamplingFeature4);
}
use of org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeatureComplex in project arctic-sea by 52North.
the class SamplingFeatureComplexTest method should_set_role_correct.
@Test
public void should_set_role_correct() {
final String role = "test-role";
final SamplingFeatureComplex sfc = new SamplingFeatureComplex(role, new SamplingFeature(new CodeWithAuthority("test-feature")));
assertThat(sfc.getRelatedSamplingFeatureRole(), is(role));
}
Aggregations