diff --git a/crates/voicevox_core_java_api/lib/src/test/java/jp/hiroshiba/voicevoxcore/VoiceModelTest.java b/crates/voicevox_core_java_api/lib/src/test/java/jp/hiroshiba/voicevoxcore/VoiceModelTest.java new file mode 100644 index 000000000..5a720b07f --- /dev/null +++ b/crates/voicevox_core_java_api/lib/src/test/java/jp/hiroshiba/voicevoxcore/VoiceModelTest.java @@ -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); + } + } +}