Skip to content

Commit

Permalink
chore: #796 に対するJavaのテストを追加 (#797)
Browse files Browse the repository at this point in the history
* chore: #796 に対するJavaのテストを追加

* テスト名を変更
  • Loading branch information
qryxip authored May 25, 2024
1 parent be8d0c0 commit 4cd19cc
Showing 1 changed file with 36 additions and 0 deletions.
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);
}
}
}

0 comments on commit 4cd19cc

Please sign in to comment.