Skip to content

Commit 87d0225

Browse files
committed
trying to make #962 test fail more reliably
1 parent 567d6c0 commit 87d0225

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

Diff for: src/main/java/com/fasterxml/jackson/databind/introspect/POJOPropertyBuilder.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public class POJOPropertyBuilder
4040
protected final PropertyName _internalName;
4141

4242
protected Linked<AnnotatedField> _fields;
43-
43+
4444
protected Linked<AnnotatedParameter> _ctorParameters;
45-
45+
4646
protected Linked<AnnotatedMethod> _getters;
4747

4848
protected Linked<AnnotatedMethod> _setters;
@@ -316,9 +316,9 @@ public AnnotatedMethod getSetter()
316316
continue;
317317
}
318318
}
319-
320-
throw new IllegalArgumentException("Conflicting setter definitions for property \""+getName()+"\": "
321-
+curr.value.getFullName()+" vs "+next.value.getFullName());
319+
throw new IllegalArgumentException(String.format(
320+
"Conflicting setter definitions for property \"%s\": %s vs %s",
321+
getName(), curr.value.getFullName(), next.value.getFullName()));
322322
}
323323
// One more thing; to avoid having to do it again...
324324
_setters = curr.withoutNext();

Diff for: src/test/java/com/fasterxml/jackson/failing/SkipInjectableIntrospection962Test.java

+7-13
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ static class InjectMe
1111
{
1212
private String a;
1313

14-
public void setA(String a) {
15-
this.a = a;
16-
}
14+
public InjectMe(boolean dummy) { }
1715

1816
public void setA(Integer a) {
1917
this.a = a.toString();
@@ -42,20 +40,16 @@ public String getB() {
4240
}
4341
}
4442

45-
public void testInjected()
43+
// 14-Jun-2016, tatu: For some odd reason, this test sometimes fails, other times not...
44+
// possibly related to unstable ordering of properties?
45+
public void testInjected() throws Exception
4646
{
47-
InjectMe im = new InjectMe();
48-
ObjectMapper sut = new ObjectMapper()
47+
InjectMe im = new InjectMe(true);
48+
ObjectMapper mapper = new ObjectMapper()
4949
.setInjectableValues(new InjectableValues.Std().addValue(InjectMe.class, im));
5050
String test = "{\"b\":\"bbb\"}";
5151

52-
Injectee actual = null;
53-
try {
54-
actual = sut.readValue(test, Injectee.class);
55-
}
56-
catch (Exception e) {
57-
fail("failed to deserialize: "+e);
58-
}
52+
Injectee actual = mapper.readValue(test, Injectee.class);
5953
assertEquals("bbb", actual.getB());
6054
}
6155
}

0 commit comments

Comments
 (0)