Skip to content

Commit

Permalink
GH-43 Adds compatibility test for WRITE_NUMBERS_AS_STRINGS feature
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderYastrebov committed May 5, 2017
1 parent a2376bb commit 639c661
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.zalando.jackson.datatype.money;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -135,4 +136,15 @@ public void shouldSerializeAmountAsStringValue() throws JsonProcessingException

assertThat(actual, is(expected));
}

@Test
public void shouldRespectJacksonFeatureByDefault() throws JsonProcessingException {
final ObjectMapper unit = unit(module());
unit.configure(JsonGenerator.Feature.WRITE_NUMBERS_AS_STRINGS, true);

final String expected = "{\"amount\":\"29.95\",\"currency\":\"EUR\"}";
final String actual = unit.writeValueAsString(amount);

assertThat(actual, is(expected));
}
}

0 comments on commit 639c661

Please sign in to comment.