-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
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
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
22 changes: 22 additions & 0 deletions
22
src/test/java/io/github/robothy/sdwebui/sdk/models/SystemInfoTest.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,22 @@ | ||
package io.github.robothy.sdwebui.sdk.models; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class SystemInfoTest { | ||
|
||
@Test | ||
void testSerialization() throws JsonProcessingException { | ||
SystemInfo systemInfo = new SystemInfo(); | ||
systemInfo.setEndpoint("http://localhost:8080"); | ||
systemInfo.setPlatform("Linux"); | ||
systemInfo.setPythonVersion("3.8.5"); | ||
systemInfo.setSdwebuiVersion("0.0.1"); | ||
ObjectMapper objectMapper = new ObjectMapper(); | ||
assertEquals(systemInfo, objectMapper | ||
.readValue(objectMapper.writeValueAsString(systemInfo), SystemInfo.class)); | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
src/test/java/io/github/robothy/sdwebui/sdk/models/results/Txt2ImgResultTest.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,26 @@ | ||
package io.github.robothy.sdwebui.sdk.models.results; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import io.github.robothy.sdwebui.sdk.models.options.Txt2ImageOptions; | ||
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class Txt2ImgResultTest { | ||
|
||
@Test | ||
void testSerialization() throws JsonProcessingException { | ||
Txt2ImgResult txt2ImgResult = new Txt2ImgResult(); | ||
txt2ImgResult.setImages(List.of("image1", "image2")); | ||
txt2ImgResult.setInfo("info"); | ||
txt2ImgResult.setParameters(Txt2ImageOptions.builder() | ||
.prompt("1dog") | ||
.build()); | ||
|
||
ObjectMapper objectMapper = new ObjectMapper(); | ||
assertEquals(txt2ImgResult, objectMapper.readValue(objectMapper | ||
.writeValueAsString(txt2ImgResult), Txt2ImgResult.class)); | ||
} | ||
|
||
} |