-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
1814956
commit b1d0f65
Showing
8 changed files
with
95 additions
and
34 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
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
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
45 changes: 45 additions & 0 deletions
45
src/test/java/edu/stanford/protege/webprotege/forms/FormDataByFormIdTest.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,45 @@ | ||
package edu.stanford.protege.webprotege.forms; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.datatype.guava.GuavaModule; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.boot.test.json.JacksonTester; | ||
import org.springframework.core.ResolvableType; | ||
|
||
import java.io.IOException; | ||
import java.io.StringReader; | ||
import java.util.Collections; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class FormDataByFormIdTest { | ||
|
||
private JacksonTester<FormDataByFormId> tester; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
var objectMapper = new ObjectMapper(); | ||
objectMapper.registerModule(new GuavaModule()); | ||
tester = new JacksonTester<>(FormDataByFormIdTest.class, | ||
ResolvableType.forClass(FormDataByFormId.class), objectMapper); | ||
} | ||
|
||
@Test | ||
void shouldSerialize() throws IOException { | ||
var written = tester.write(new FormDataByFormId(Collections.emptyMap())); | ||
assertThat(written).isEqualToJson("{}"); | ||
} | ||
|
||
@Test | ||
void shouldDeserialize() throws IOException { | ||
var read = tester.read(new StringReader(""" | ||
{ | ||
} | ||
""")); | ||
read.assertThat().isNotNull(); | ||
} | ||
} |
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