Skip to content

Commit

Permalink
More test config fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 7, 2025
1 parent 216cdd3 commit 7cbc141
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.fasterxml.jackson.annotation.*;

import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil;

Expand Down Expand Up @@ -88,7 +89,11 @@ public AsArrayWithViewAndCreator(@JsonProperty("a") int a,
/*****************************************************
*/

private final static ObjectMapper MAPPER = newJsonMapper();
// 06-Jan-2025, tatu: NOTE! need to make sure Default View Inclusion
// is enabled for tests to work as expected
private final static ObjectMapper MAPPER = jsonMapperBuilder()
.enable(MapperFeature.DEFAULT_VIEW_INCLUSION)
.build();

@Test
public void testWithView() throws Exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.fasterxml.jackson.annotation.*;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
Expand Down Expand Up @@ -170,7 +171,13 @@ public void testWithCreator() throws Exception
@Test
public void testWithCreatorAndView() throws Exception
{
ObjectReader reader = MAPPER.readerFor(CreatorValue.class);
// 06-Jan-2025, tatu: NOTE! need to make sure Default View Inclusion
// is enabled for tests to work as expected
ObjectReader reader = jsonMapperBuilder()
.enable(MapperFeature.DEFAULT_VIEW_INCLUSION)
.build()
.readerFor(CreatorValue.class);

CreatorValue value;

// First including values in view
Expand Down

0 comments on commit 7cbc141

Please sign in to comment.