-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: #796 に対するJavaのテストを追加 * テスト名を変更
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...es/voicevox_core_java_api/lib/src/test/java/jp/hiroshiba/voicevoxcore/VoiceModelTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |