Skip to content

Commit 82a0db9

Browse files
committed
Minor test cleanup to make merging to master easier
1 parent 0334a27 commit 82a0db9

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

avro/src/test/java/com/fasterxml/jackson/dataformat/avro/RoundtripTest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public org.apache.avro.Schema getSchema() {
5151
public void testIssue9() throws Exception
5252
{
5353
AvroSchema jsch = getEmployeeSchema();
54-
ObjectMapper mapper = new ObjectMapper(new AvroFactory());
54+
ObjectMapper mapper = new AvroMapper();
5555

5656
ObjectWriter writ = mapper.writer(jsch);
5757
ObjectMapper unzip = new ObjectMapper();
@@ -62,8 +62,9 @@ public void testIssue9() throws Exception
6262

6363
public void testCharSequences() throws Exception
6464
{
65-
ObjectMapper mapper = new AvroMapper()
66-
.enable(JsonGenerator.Feature.IGNORE_UNKNOWN);
65+
ObjectMapper mapper = AvroMapper.builder()
66+
.enable(JsonGenerator.Feature.IGNORE_UNKNOWN)
67+
.build();
6768
ObjectWriter writ = mapper.writer(CHARSEQ_SCHEMA);
6869

6970
CharSeqBean input = new CharSeqBean();
@@ -86,8 +87,9 @@ public void testCharSequencesLowStringLimit() throws Exception
8687
AvroFactory factory = AvroFactory.builder()
8788
.streamReadConstraints(StreamReadConstraints.builder().maxStringLength(1).build())
8889
.build();
89-
ObjectMapper mapper = new AvroMapper(factory)
90-
.enable(JsonGenerator.Feature.IGNORE_UNKNOWN);
90+
ObjectMapper mapper = AvroMapper.builder(factory)
91+
.enable(JsonGenerator.Feature.IGNORE_UNKNOWN)
92+
.build();
9193
ObjectWriter writ = mapper.writer(CHARSEQ_SCHEMA);
9294

9395
CharSeqBean input = new CharSeqBean();

protobuf/src/test/java/com/fasterxml/jackson/dataformat/protobuf/ReadSimpleTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import com.fasterxml.jackson.core.JsonParser;
77
import com.fasterxml.jackson.core.JsonToken;
88
import com.fasterxml.jackson.core.StreamReadConstraints;
9+
import com.fasterxml.jackson.databind.DatabindException;
910
import com.fasterxml.jackson.databind.JsonMappingException;
1011
import com.fasterxml.jackson.databind.ObjectMapper;
1112
import com.fasterxml.jackson.databind.ObjectWriter;
@@ -376,8 +377,8 @@ public void testStringArraySimpleLowLimit() throws Exception
376377

377378
try {
378379
protobufMapper.readerFor(Strings.class).with(schema).readValue(bytes);
379-
fail("Expected JsonMappingException");
380-
} catch (JsonMappingException jme) {
380+
fail("Expected DatabindException");
381+
} catch (DatabindException jme) {
381382
String message = jme.getMessage();
382383
assertTrue("unexpected message: " + message,
383384
message.startsWith("String length (4) exceeds the maximum length (1)"));

0 commit comments

Comments
 (0)