{
final String json = buildJson(new String[] {traceStr(1, "parent", ResultType.UNFINISHED, false),
traceStr(2, "child", ResultType.UNFINISHED, false),
traceStr(3, "predecessor", ResultType.UNFINISHED, false)},
new String[] {hierStr(1, 2), orderStr(3, 1)});
final Trace trace;
try
{
trace = decodeString(json);
}
catch (IOException e)
{
fail("JSON parse failed. Document:\n" + json + "\nError: " + e.toString());
return;
}
assertEquals("parent", trace.getName());
assertEquals(ResultType.UNFINISHED, trace.getResultType());
assertEquals(2, trace.getRelated().size());
String childName = null;
String predecessorName = null;
for (Related<Trace> related : trace.getRelated())
{
if (related.getRelationship().equals(Relationship.PARENT_OF.name()))
{
childName = related.getRelated().getName();
}