Adds tests for common whisper

This commit is contained in:
Guillaume Tâche
2024-09-16 14:01:57 +02:00
parent dcadbcaf36
commit 3cc2f7a0c9
38 changed files with 796 additions and 130 deletions

View File

@@ -7,10 +7,10 @@ import java.util.Objects;
/**
* Implementation of {@link AudioInfo}
*/
public record AudioInfoImpl(String audioFormat, long duration) implements AudioInfo {
public record AudioInfoImpl(String format, long duration) implements AudioInfo {
public AudioInfoImpl {
Objects.requireNonNull(audioFormat);
Objects.requireNonNull(format);
if (duration < 0) {
throw new IllegalArgumentException("Duration must be positive");
}

View File

@@ -7,10 +7,10 @@ import java.util.Objects;
/**
* Implementation of {@link VideoInfo}
*/
public record VideoInfoImpl(String videoFormat, int width, int height, long duration) implements VideoInfo {
public record VideoInfoImpl(String format, int width, int height, long duration) implements VideoInfo {
public VideoInfoImpl {
Objects.requireNonNull(videoFormat);
Objects.requireNonNull(format);
if (width <= 0) {
throw new IllegalArgumentException("Width must be greater than 0 : " + width);
}

View File

@@ -11,14 +11,14 @@ class TestAudioInfoImpl {
private final long duration;
TestAudioInfoImpl() {
this.audioFormat = "audioFormat";
this.audioFormat = "format";
this.duration = 1000L;
}
@Test
void testGetters() {
final var audioInfo = new AudioInfoImpl(audioFormat, duration);
assertEquals(audioFormat, audioInfo.audioFormat());
assertEquals(audioFormat, audioInfo.format());
assertEquals(duration, audioInfo.duration());
}

View File

@@ -13,7 +13,7 @@ class TestVideoInfoImpl {
private final long duration;
TestVideoInfoImpl() {
this.videoFormat = "videoFormat";
this.videoFormat = "format";
this.width = 1;
this.height = 2;
this.duration = 3;
@@ -22,7 +22,7 @@ class TestVideoInfoImpl {
@Test
void testGetters() {
final var videoInfo = new VideoInfoImpl(videoFormat, width, height, duration);
assertEquals(videoFormat, videoInfo.videoFormat());
assertEquals(videoFormat, videoInfo.format());
assertEquals(width, videoInfo.width());
assertEquals(height, videoInfo.height());
assertEquals(duration, videoInfo.duration());

View File

@@ -57,7 +57,7 @@ class TestAbstractSubtitleExtractor {
private static final class DummySubtitleExtractor extends AbstractSubtitleExtractor {
@Override
public SubtitleCollection<Subtitle> extract(final Video video, final Language language, final ExtractionModel model) throws ExtractException {
public SubtitleCollection extract(final Video video, final Language language, final ExtractionModel model) throws ExtractException {
throw new UnsupportedOperationException();
}