XStream xStream = new XStream2();
xStream.registerConverter(new TriggerContextConverter());
xStream.alias("matrix-run", MatrixRun.class);
Object obj = xStream.fromXML(getClass().getResourceAsStream("matrix_build.xml"));
assertTrue(obj instanceof MatrixRun);
MatrixRun run = (MatrixRun)obj;
Cause.UpstreamCause upCause = run.getCause(Cause.UpstreamCause.class);
List upstreamCauses = Whitebox.getInternalState(upCause, "upstreamCauses");
GerritCause cause = (GerritCause)upstreamCauses.get(0);
assertNotNull(cause.getEvent());
assertThat("Event is not a ChangeBasedEvent", cause.getEvent(), instanceOf(ChangeBasedEvent.class));
ChangeBasedEvent changeBasedEvent = (ChangeBasedEvent)cause.getEvent();