-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed License reference (WIP) Removed cross-module dependency to jsonSchema Testing specific Modules instead of findAndRegisterModules Assert subtypes of JSONProcessingException CurrencyUnitDeserializer extends StdScalarDeserializer CurrencyUnitSerializer extends StdScalarSerializer MonetaryAmountDeserializer throws semantic exceptions using DeserializationContext MoneyModule version uses PackageVersion
- Loading branch information
1 parent
abaf36d
commit 8d99b6d
Showing
10 changed files
with
50 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
TODO What goes here? (This original one or another?) | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015-2016 Zalando SE | ||
|
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
17 changes: 7 additions & 10 deletions
17
.../src/test/java/com/fasterxml/jackson/datatype/money/CurrencyUnitSchemaSerializerTest.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 |
---|---|---|
@@ -1,25 +1,22 @@ | ||
package com.fasterxml.jackson.datatype.money; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.module.jsonSchema.JsonSchema; | ||
import com.fasterxml.jackson.module.jsonSchema.JsonSchemaGenerator; | ||
import com.kjetland.jackson.jsonSchema.JsonSchemaGenerator; | ||
import org.junit.Test; | ||
|
||
import javax.money.CurrencyUnit; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public final class CurrencyUnitSchemaSerializerTest { | ||
|
||
private final ObjectMapper unit = new ObjectMapper().findAndRegisterModules(); | ||
private final ObjectMapper unit = new ObjectMapper().registerModule(new MoneyModule()); | ||
|
||
@Test | ||
public void shouldSerializeJsonSchema() throws Exception { | ||
public void shouldSerializeJsonSchema() { | ||
JsonSchemaGenerator generator = new JsonSchemaGenerator(unit); | ||
JsonSchema jsonSchema = generator.generateSchema(CurrencyUnit.class); | ||
final String actual = unit.writeValueAsString(jsonSchema); | ||
final String expected = "{\"type\":\"string\"}"; | ||
|
||
assertThat(actual).isEqualTo(expected); | ||
JsonNode schemaNode = generator.generateJsonSchema(CurrencyUnit.class); | ||
assertThat(schemaNode.get("type")).isNotNull(); | ||
assertThat(schemaNode.get("type").asText()).isEqualTo("string"); | ||
} | ||
} |
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