Skip to content

Commit

Permalink
Restore test coverage in translator module
Browse files Browse the repository at this point in the history
  • Loading branch information
paytoncain committed Aug 23, 2024
1 parent c766925 commit 7df2350
Showing 1 changed file with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -2223,4 +2225,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());
}
}

0 comments on commit 7df2350

Please sign in to comment.