Skip to content

Commit

Permalink
Add a test for #4595
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jun 25, 2024
1 parent 5a7704b commit 0469ab7
Showing 1 changed file with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,17 @@ public String findTypeName(AnnotatedClass ac) {
return (String) values.get("findTypeName");
}

/*
/******************************************************
/* General member (field, method/constructor) annotations
/******************************************************
*/

@Override
public PropertyName findWrapperName(Annotated ann) {
return (PropertyName) values.get("findWrapperName");
}

/*
/******************************************************
/* Serialization introspection
Expand Down Expand Up @@ -386,6 +397,42 @@ public void testFindClassDescription() throws Exception

// // // 3 deprecated methods, skip

/*
/**********************************************************
/* Test methods, general member annotations
/**********************************************************
*/

@Test
public void testFindWrapperName() throws Exception
{
final PropertyName NAME_WITH_NS = PropertyName.construct("simple", "ns");
final PropertyName NAME_NO_NS = PropertyName.construct("other", null);

assertNull(new AnnotationIntrospectorPair(NO_ANNOTATIONS, NO_ANNOTATIONS)
.findClassDescription(null));

// First: basic merging of namespace/localname info
IntrospectorWithMap intr1 = new IntrospectorWithMap()
.add("findWrapperName", NAME_WITH_NS);
IntrospectorWithMap intr2 = new IntrospectorWithMap()
.add("findWrapperName", NAME_NO_NS);
assertSame(NAME_WITH_NS,
new AnnotationIntrospectorPair(intr1, intr2).findWrapperName(null));
assertEquals(PropertyName.construct("other", "ns"),
new AnnotationIntrospectorPair(intr2, intr1).findWrapperName(null));

// [databind#4595]: NO_NAME should be retained, not merged
intr1 = new IntrospectorWithMap()
.add("findWrapperName", PropertyName.NO_NAME);
intr2 = new IntrospectorWithMap()
.add("findWrapperName", NAME_WITH_NS);
assertSame(PropertyName.NO_NAME,
new AnnotationIntrospectorPair(intr1, intr2).findWrapperName(null));
assertSame(NAME_WITH_NS,
new AnnotationIntrospectorPair(intr2, intr1).findWrapperName(null));
}

/*
/**********************************************************
/* Test methods, ser/deser
Expand Down

0 comments on commit 0469ab7

Please sign in to comment.