Skip to content

Commit

Permalink
rename the testobjectmapper
Browse files Browse the repository at this point in the history
  • Loading branch information
ryber committed Sep 15, 2022
1 parent 6c95ea0 commit 7c1562d
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

class AsBytesTest extends BddTest {
JacksonObjectMapper om = new JacksonObjectMapper();
TestObjectMapper om = new TestObjectMapper();

@Test
void getGetResultAsBytes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
class AsFileTest extends BddTest {

private final Path test = Paths.get("results.json");
private final JacksonObjectMapper om = new JacksonObjectMapper();
private final TestObjectMapper om = new TestObjectMapper();

@Override @AfterEach
public void tearDown() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ void canSetObjectMapperToFailOnUnknown() {
com.fasterxml.jackson.databind.ObjectMapper jack = new com.fasterxml.jackson.databind.ObjectMapper();
jack.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);

Unirest.config().setObjectMapper(new JacksonObjectMapper(jack));
Unirest.config().setObjectMapper(new TestObjectMapper(jack));

MockServer.setStringResponse("{\"foo\": [1,2,3] }");

Expand All @@ -214,7 +214,7 @@ public static class TestingMapper implements ObjectMapper {
@Override
public <T> T readValue(String value, Class<T> valueType) {
this.readWasCalled = true;
return new JacksonObjectMapper().readValue(value, valueType);
return new TestObjectMapper().readValue(value, valueType);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion unirest-bdd-tests/src/test/java/BehaviorTests/BddTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import static org.junit.jupiter.api.Assertions.*;

public class BddTest {
private static final JacksonObjectMapper objectMapper = new JacksonObjectMapper();
private static final TestObjectMapper objectMapper = new TestObjectMapper();
private CountDownLatch lock;
private boolean status;
private String fail;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void ifNoErrorThenGetTheRegularBody() {

@Test
void failsIfErrorResponseCantBeMapped() {
JacksonObjectMapper om = new JacksonObjectMapper();
TestObjectMapper om = new TestObjectMapper();
om.om.configure(JsonGenerator.Feature.IGNORE_UNKNOWN, false);
om.om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class MockServer {
private static final List<Pair<String, String>> responseHeaders = new ArrayList<>();
private static final List<Cookie> cookies = new ArrayList<>();

private static final JacksonObjectMapper om = new JacksonObjectMapper();
private static final TestObjectMapper om = new TestObjectMapper();
private static String responseBody;
public static final int PORT = 4567;
public static final String HOST = "http://localhost:" + PORT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
import java.io.IOException;
import java.io.InputStream;

public class JacksonObjectMapper implements ObjectMapper {
public class TestObjectMapper implements ObjectMapper {

public final com.fasterxml.jackson.databind.ObjectMapper om;

public JacksonObjectMapper(com.fasterxml.jackson.databind.ObjectMapper om){
public TestObjectMapper(com.fasterxml.jackson.databind.ObjectMapper om){
this.om = om;
}

public JacksonObjectMapper(){
public TestObjectMapper(){
this(new com.fasterxml.jackson.databind.ObjectMapper());
om.registerModule(new GuavaModule());
SimpleModule simpleModule = new SimpleModule();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONAssert;

class JacksonObjectMapperTest {
class TestObjectMapperTest {

private final JacksonObjectMapper om = new JacksonObjectMapper();
private final TestObjectMapper om = new TestObjectMapper();

@Test
void jsonPatch() throws JSONException {
Expand Down

0 comments on commit 7c1562d

Please sign in to comment.