Skip to content

Commit

Permalink
Minor test fixes (backport from master)
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 30, 2025
1 parent 1e56ff8 commit fd61dc6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,18 @@ protected static XmlMapper.Builder mapperBuilder() {
return XmlMapper.builder();
}

protected static XmlMapper.Builder mapperBuilder(boolean useListWrapping) {
return XmlMapper.builder()
.defaultUseWrapper(useListWrapping);
}

protected static XmlMapper.Builder mapperBuilder(XmlFactory f) {
return XmlMapper.builder(f);
}

protected XmlMapper xmlMapper(boolean useListWrapping)
{
JacksonXmlModule module = new JacksonXmlModule();
module.setDefaultUseWrapper(useListWrapping);
return new XmlMapper(module);
return mapperBuilder(useListWrapping).build();
}

protected AnnotationIntrospector jakartaXMLBindAnnotationIntrospector() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,15 @@ public void testBuilderMethodReturnMoreGeneral() throws Exception
@Test
public void testBuilderMethodReturnMoreSpecific() throws Exception
{
final String json = "<ValueInterface2><x>1</x></ValueInterface2>}";
final String json = "<ValueInterface2><x>1</x></ValueInterface2>";
ValueInterface2 value = MAPPER.readValue(json, ValueInterface2.class);
assertEquals(2, value.getX());
}

@Test
public void testSelfBuilder777() throws Exception
{
SelfBuilder777 result = MAPPER.readValue("<SelfBuilder777><x>3</x></SelfBuilder777>'",
SelfBuilder777 result = MAPPER.readValue("<SelfBuilder777><x>3</x></SelfBuilder777>",
SelfBuilder777.class);
assertNotNull(result);
assertEquals(3, result.x);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ public void testSimpleRead() throws Exception
assertEquals(sr.next(), XMLStreamConstants.START_ELEMENT);
assertEquals("root", sr.getLocalName());

/* 30-May-2014, tatu: This is bit tricky... need to ensure that currently
* pointed to START_ELEMENT is sort of re-read.
*/
// 30-May-2014, tatu: This is bit tricky... need to ensure that currently
// pointed to START_ELEMENT is sort of re-read.
assertEquals(sr.next(), XMLStreamConstants.START_ELEMENT);
assertEquals("NameBean", sr.getLocalName());

Expand Down

0 comments on commit fd61dc6

Please sign in to comment.