• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.fasterxml.jackson.databind.struct;
2 
3 import com.fasterxml.jackson.annotation.JsonUnwrapped;
4 import com.fasterxml.jackson.databind.*;
5 
6 public class TestUnwrappedWithSameName647 extends BaseMapTest
7 {
8     static class UnwrappedWithSamePropertyName {
9         public MailHolder mail;
10     }
11 
12     static class MailHolder {
13         @JsonUnwrapped
14         public Mail mail;
15     }
16 
17     static class Mail {
18         public String mail;
19     }
20 
21     private final ObjectMapper MAPPER = new ObjectMapper();
22 
testUnwrappedWithSamePropertyName()23     public void testUnwrappedWithSamePropertyName() throws Exception {
24         final String JSON = "{'mail': {'mail': 'the mail text'}}";
25         UnwrappedWithSamePropertyName result = MAPPER.readValue(aposToQuotes(JSON), UnwrappedWithSamePropertyName.class);
26         assertNotNull(result.mail);
27         assertNotNull(result.mail.mail);
28         assertEquals("the mail text", result.mail.mail.mail);
29     }
30 }
31