diff --git a/pace-data/src/test/java/edu/colorado/cires/pace/data/object/AudioPackageTest.java b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/AudioPackageTest.java new file mode 100644 index 00000000..61801d3a --- /dev/null +++ b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/AudioPackageTest.java @@ -0,0 +1,11 @@ +package edu.colorado.cires.pace.data.object; + +import edu.colorado.cires.pace.data.object.dataset.audio.AudioPackage; + +public class AudioPackageTest extends PackageTest { + + @Override + protected AudioPackage createObject() { + return AudioPackage.builder().build(); + } +} diff --git a/pace-data/src/test/java/edu/colorado/cires/pace/data/object/CPODPackageTest.java b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/CPODPackageTest.java new file mode 100644 index 00000000..6657a14b --- /dev/null +++ b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/CPODPackageTest.java @@ -0,0 +1,11 @@ +package edu.colorado.cires.pace.data.object; + +import edu.colorado.cires.pace.data.object.dataset.audio.CPODPackage; + +public class CPODPackageTest extends PackageTest { + + @Override + protected CPODPackage createObject() { + return CPODPackage.builder().build(); + } +} diff --git a/pace-data/src/test/java/edu/colorado/cires/pace/data/object/DetectionsPackageTest.java b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/DetectionsPackageTest.java new file mode 100644 index 00000000..d9bf9145 --- /dev/null +++ b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/DetectionsPackageTest.java @@ -0,0 +1,11 @@ +package edu.colorado.cires.pace.data.object; + +import edu.colorado.cires.pace.data.object.dataset.detections.DetectionsPackage; + +public class DetectionsPackageTest extends PackageTest { + + @Override + protected DetectionsPackage createObject() { + return DetectionsPackage.builder().build(); + } +} diff --git a/pace-data/src/test/java/edu/colorado/cires/pace/data/object/PackageTest.java b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/PackageTest.java new file mode 100644 index 00000000..ec639594 --- /dev/null +++ b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/PackageTest.java @@ -0,0 +1,8 @@ +package edu.colorado.cires.pace.data.object; + +import edu.colorado.cires.pace.data.ObjectWithUniqueFieldTest; +import edu.colorado.cires.pace.data.object.dataset.base.Package; + +public abstract class PackageTest

extends ObjectWithUniqueFieldTest

{ + +} diff --git a/pace-data/src/test/java/edu/colorado/cires/pace/data/object/SoundClipsPackageTest.java b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/SoundClipsPackageTest.java new file mode 100644 index 00000000..bb7f5abb --- /dev/null +++ b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/SoundClipsPackageTest.java @@ -0,0 +1,11 @@ +package edu.colorado.cires.pace.data.object; + +import edu.colorado.cires.pace.data.object.dataset.soundClips.SoundClipsPackage; + +public class SoundClipsPackageTest extends PackageTest { + + @Override + protected SoundClipsPackage createObject() { + return SoundClipsPackage.builder().build(); + } +} diff --git a/pace-data/src/test/java/edu/colorado/cires/pace/data/object/SoundLevelMetricsPackageTest.java b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/SoundLevelMetricsPackageTest.java new file mode 100644 index 00000000..4a83c344 --- /dev/null +++ b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/SoundLevelMetricsPackageTest.java @@ -0,0 +1,11 @@ +package edu.colorado.cires.pace.data.object; + +import edu.colorado.cires.pace.data.object.dataset.soundLevelMetrics.SoundLevelMetricsPackage; + +public class SoundLevelMetricsPackageTest extends PackageTest { + + @Override + protected SoundLevelMetricsPackage createObject() { + return SoundLevelMetricsPackage.builder().build(); + } +} diff --git a/pace-data/src/test/java/edu/colorado/cires/pace/data/object/SoundPropagationModelsTest.java b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/SoundPropagationModelsTest.java new file mode 100644 index 00000000..0571bdc6 --- /dev/null +++ b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/SoundPropagationModelsTest.java @@ -0,0 +1,11 @@ +package edu.colorado.cires.pace.data.object; + +import edu.colorado.cires.pace.data.object.dataset.soundPropagationModels.SoundPropagationModelsPackage; + +public class SoundPropagationModelsTest extends PackageTest { + + @Override + protected SoundPropagationModelsPackage createObject() { + return SoundPropagationModelsPackage.builder().build(); + } +} diff --git a/pace-data/src/test/java/edu/colorado/cires/pace/data/object/TestResolvePackageId.java b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/TestResolvePackageId.java index 2aafb868..4ff8a31a 100644 --- a/pace-data/src/test/java/edu/colorado/cires/pace/data/object/TestResolvePackageId.java +++ b/pace-data/src/test/java/edu/colorado/cires/pace/data/object/TestResolvePackageId.java @@ -45,5 +45,14 @@ void testResolvePackageIdEmptyProjects() { "%s_%s", aPackage.getSiteOrCruiseName(), aPackage.getDeploymentId() ), aPackage.getPackageId()); } + + @Test + void testResolvePackageIdDataCollectionNameSpecified() { + Package aPackage = AudioPackage.builder() + .dataCollectionName("dataCollectionName") + .build(); + + assertEquals("dataCollectionName", aPackage.getPackageId()); + } } diff --git a/pace-translator/src/test/java/edu/colorado/cires/pace/translator/converter/PackageConverterTest.java b/pace-translator/src/test/java/edu/colorado/cires/pace/translator/converter/PackageConverterTest.java index bd2918a8..5222f6f5 100644 --- a/pace-translator/src/test/java/edu/colorado/cires/pace/translator/converter/PackageConverterTest.java +++ b/pace-translator/src/test/java/edu/colorado/cires/pace/translator/converter/PackageConverterTest.java @@ -7,6 +7,8 @@ import edu.colorado.cires.pace.data.object.dataset.audio.AudioPackage; import edu.colorado.cires.pace.data.object.dataset.audio.CPODPackage; import edu.colorado.cires.pace.data.object.dataset.audio.metadata.Channel; +import edu.colorado.cires.pace.data.object.dataset.base.metadata.location.LocationDetail; +import edu.colorado.cires.pace.data.object.dataset.base.metadata.location.translator.LocationDetailTranslator; import edu.colorado.cires.pace.data.object.dataset.base.metadata.translator.DataQualityEntry; import edu.colorado.cires.pace.data.object.dataset.detections.DetectionsPackage; import edu.colorado.cires.pace.data.object.dataset.audio.metadata.DutyCycle; @@ -2215,4 +2217,56 @@ void covertInvalidPackageType() { Exception exception = assertThrows(TranslationException.class, () -> converter.convert(packageTranslator, Collections.emptyMap(), 1, new RuntimeException())); assertEquals("Translation not supported for PackageTranslator", exception.getMessage()); } + + @Test + void testUnspecifiedLocationDetail() throws TranslationException { + + Package aPackage = converter.convert( + AudioPackageTranslator.builder().locationDetailTranslator(null).build(), + Collections.emptyMap(), + 0, + new RuntimeException() + ); + assertNull(aPackage.getLocationDetail()); + + aPackage = converter.convert( + CPODPackageTranslator.builder().locationDetailTranslator(null).build(), + Collections.emptyMap(), + 0, + new RuntimeException() + ); + assertNull(aPackage.getLocationDetail()); + + aPackage = converter.convert( + DetectionsPackageTranslator.builder().locationDetailTranslator(null).build(), + Collections.emptyMap(), + 0, + new RuntimeException() + ); + assertNull(aPackage.getLocationDetail()); + + aPackage = converter.convert( + SoundClipsPackageTranslator.builder().locationDetailTranslator(null).build(), + Collections.emptyMap(), + 0, + new RuntimeException() + ); + assertNull(aPackage.getLocationDetail()); + + aPackage = converter.convert( + SoundLevelMetricsPackageTranslator.builder().locationDetailTranslator(null).build(), + Collections.emptyMap(), + 0, + new RuntimeException() + ); + assertNull(aPackage.getLocationDetail()); + + aPackage = converter.convert( + SoundPropagationModelsPackageTranslator.builder().locationDetailTranslator(null).build(), + Collections.emptyMap(), + 0, + new RuntimeException() + ); + assertNull(aPackage.getLocationDetail()); + } } \ No newline at end of file