Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: #796 に対するJavaのテストを追加 #797

Merged
merged 2 commits into from
May 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package jp.hiroshiba.voicevoxcore;

import static org.junit.jupiter.api.Assertions.assertEquals;

import com.google.gson.Gson;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import jakarta.annotation.Nonnull;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.UUID;
import org.junit.jupiter.api.Test;

class VoiceModelTest extends TestUtils {
@Test
void idShouldBePreservedAsIs() throws IOException {
UUID expected = UUID.fromString(Manifest.readJson().id);
UUID actual = loadModel().id;
assertEquals(expected, actual);
}

private static class Manifest {
@SerializedName("id")
@Expose
@Nonnull
String id;

static Manifest readJson() throws IOException {
Path path = new File("../../../model/sample.vvm/manifest.json").toPath();
String json = new String(Files.readAllBytes(path));
return new Gson().fromJson(json, Manifest.class);
}
}
}
Loading