Skip to content

Commit b5cb96c

Browse files
committed
add a failing test for #1382
1 parent faf68c5 commit b5cb96c

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.fasterxml.jackson.failing;
2+
3+
import java.util.*;
4+
5+
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import com.fasterxml.jackson.databind.*;
7+
8+
public class ReadOnlyDeser1382Test extends BaseMapTest
9+
{
10+
static class Foo {
11+
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
12+
private List<Long> list = new ArrayList<>();
13+
14+
List<Long> getList() {
15+
return list;
16+
}
17+
18+
public Foo setList(List<Long> list) {
19+
this.list = list;
20+
return this;
21+
}
22+
}
23+
24+
public void testReadOnly() throws Exception
25+
{
26+
final ObjectMapper mapper = new ObjectMapper();
27+
String payload = "{\"list\":[1,2,3,4]}";
28+
Foo foo = mapper.readValue(payload, Foo.class);
29+
assertTrue("List should be empty", foo.getList().isEmpty());
30+
}
31+
}

0 commit comments

Comments
 (0)