Skip to content

Commit

Permalink
[hotfix] [tests] Let MarshallingTestBases read the value from String …
Browse files Browse the repository at this point in the history
…value
  • Loading branch information
tillrohrmann committed Dec 1, 2017
1 parent 6aced12 commit c1ffc11
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Expand Up @@ -21,7 +21,6 @@
import org.apache.flink.runtime.rest.util.RestMapperUtils; import org.apache.flink.runtime.rest.util.RestMapperUtils;
import org.apache.flink.util.TestLogger; import org.apache.flink.util.TestLogger;


import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonNode;
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper; import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper;


import org.junit.Assert; import org.junit.Assert;
Expand Down Expand Up @@ -54,9 +53,9 @@ public void testJsonMarshalling() throws Exception {
final R expected = getTestRequestInstance(); final R expected = getTestRequestInstance();


ObjectMapper objectMapper = RestMapperUtils.getStrictObjectMapper(); ObjectMapper objectMapper = RestMapperUtils.getStrictObjectMapper();
JsonNode json = objectMapper.valueToTree(expected); final String marshalled = objectMapper.writeValueAsString(expected);


final R unmarshalled = objectMapper.treeToValue(json, getTestRequestClass()); final R unmarshalled = objectMapper.readValue(marshalled, getTestRequestClass());
Assert.assertEquals(expected, unmarshalled); Assert.assertEquals(expected, unmarshalled);
} }


Expand Down
Expand Up @@ -21,7 +21,6 @@
import org.apache.flink.runtime.rest.util.RestMapperUtils; import org.apache.flink.runtime.rest.util.RestMapperUtils;
import org.apache.flink.util.TestLogger; import org.apache.flink.util.TestLogger;


import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonNode;
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper; import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper;


import org.junit.Assert; import org.junit.Assert;
Expand Down Expand Up @@ -54,9 +53,9 @@ public void testJsonMarshalling() throws Exception {
final R expected = getTestResponseInstance(); final R expected = getTestResponseInstance();


ObjectMapper objectMapper = RestMapperUtils.getStrictObjectMapper(); ObjectMapper objectMapper = RestMapperUtils.getStrictObjectMapper();
JsonNode json = objectMapper.valueToTree(expected); final String marshalled = objectMapper.writeValueAsString(expected);


final R unmarshalled = objectMapper.treeToValue(json, getTestResponseClass()); final R unmarshalled = objectMapper.readValue(marshalled, getTestResponseClass());
assertOriginalEqualsToUnmarshalled(expected, unmarshalled); assertOriginalEqualsToUnmarshalled(expected, unmarshalled);
} }


Expand Down

0 comments on commit c1ffc11

Please sign in to comment.