Skip to content

Commit

Permalink
trying to make #962 test fail more reliably
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jun 15, 2016
1 parent 567d6c0 commit 87d0225
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public class POJOPropertyBuilder
protected final PropertyName _internalName;

protected Linked<AnnotatedField> _fields;

protected Linked<AnnotatedParameter> _ctorParameters;

protected Linked<AnnotatedMethod> _getters;

protected Linked<AnnotatedMethod> _setters;
Expand Down Expand Up @@ -316,9 +316,9 @@ public AnnotatedMethod getSetter()
continue;
}
}

throw new IllegalArgumentException("Conflicting setter definitions for property \""+getName()+"\": "
+curr.value.getFullName()+" vs "+next.value.getFullName());
throw new IllegalArgumentException(String.format(
"Conflicting setter definitions for property \"%s\": %s vs %s",
getName(), curr.value.getFullName(), next.value.getFullName()));
}
// One more thing; to avoid having to do it again...
_setters = curr.withoutNext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ static class InjectMe
{
private String a;

public void setA(String a) {
this.a = a;
}
public InjectMe(boolean dummy) { }

public void setA(Integer a) {
this.a = a.toString();
Expand Down Expand Up @@ -42,20 +40,16 @@ public String getB() {
}
}

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

Injectee actual = null;
try {
actual = sut.readValue(test, Injectee.class);
}
catch (Exception e) {
fail("failed to deserialize: "+e);
}
Injectee actual = mapper.readValue(test, Injectee.class);
assertEquals("bbb", actual.getB());
}
}

0 comments on commit 87d0225

Please sign in to comment.