Enable JSON data formatting on export.
Resolves gh-89.
This commit is contained in:
@@ -366,9 +366,9 @@ public class JsonCacheDataImporterExporterIntegrationTests extends IntegrationTe
|
||||
|
||||
closeApplicationContext();
|
||||
|
||||
String actualJson = writer.toString();
|
||||
String actualJson = StringUtils.trimAllWhitespace(writer.toString());
|
||||
|
||||
String expectedJson = String.format("[{\"@type\":\"%s\",\"id\":42,\"name\":\"Play Doe\"}]",
|
||||
String expectedJson = String.format("[{\"@type\":\"%s\",\"id\":42,\"name\":\"PlayDoe\"}]",
|
||||
playDoe.getClass().getName());
|
||||
|
||||
assertThat(actualJson).isEqualTo(expectedJson);
|
||||
|
||||
@@ -281,7 +281,7 @@ public class JSONFormatterPdxToJsonConverterUnitTests {
|
||||
public void decorateJsonForReal() {
|
||||
|
||||
String json = "{ \"name\": \"Jon Doe\" }";
|
||||
String expectedJson = String.format("{\"name\":\"Jon Doe\",\"%s\":\"%s\"}",
|
||||
String expectedJson = String.format("{\n \"name\" : \"Jon Doe\",\n \"%s\" : \"%s\"\n}",
|
||||
JSONFormatterPdxToJsonConverter.AT_TYPE_METADATA_PROPERTY_NAME, Customer.class.getName());
|
||||
|
||||
PdxInstance mockPdxInstance = mock(PdxInstance.class);
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.MapperFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -150,6 +151,7 @@ public class JacksonObjectToJsonConverterUnitTests {
|
||||
doReturn(mockObjectMapper).when(mockObjectMapper).addMixIn(any(), any());
|
||||
doReturn(mockObjectMapper).when(mockObjectMapper).configure(any(JsonGenerator.Feature.class), anyBoolean());
|
||||
doReturn(mockObjectMapper).when(mockObjectMapper).configure(any(MapperFeature.class), anyBoolean());
|
||||
doReturn(mockObjectMapper).when(mockObjectMapper).configure(any(SerializationFeature.class), anyBoolean());
|
||||
doReturn(mockObjectMapper).when(mockObjectMapper).findAndRegisterModules();
|
||||
|
||||
ObjectMapper objectMapper = converter.newObjectMapper(target);
|
||||
@@ -164,6 +166,8 @@ public class JacksonObjectToJsonConverterUnitTests {
|
||||
.configure(eq(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN), eq(true));
|
||||
verify(mockObjectMapper, times(1))
|
||||
.configure(eq(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY), eq(true));
|
||||
verify(mockObjectMapper, times(1))
|
||||
.configure(eq(SerializationFeature.INDENT_OUTPUT), eq(true));
|
||||
verify(mockObjectMapper, times(1)).findAndRegisterModules();
|
||||
verifyNoMoreInteractions(mockObjectMapper);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user