}
}
@Test
public void testResolveBackReferences() {
MuSyntax syntax = new MuAlternation("root", new MuBackReference("root"), null);
syntax.resolveBackReferences();
Assert.assertEquals(((MuAlternation) syntax).getAlternatives()[0], syntax);
syntax =
new MuAlternation("root", new MuSequence(new MuBackReference("root"),
new MuBackReference("root")), null);
syntax.resolveBackReferences();
MuSyntax[] tmp = ((MuAlternation) syntax).getAlternatives();
Assert.assertEquals(((MuSequence) tmp[0]).getElements()[0], syntax);
Assert.assertEquals(((MuSequence) tmp[0]).getElements()[1], syntax);
try {
syntax = new MuAlternation("root", new MuBackReference("foo"), null);
syntax.resolveBackReferences();
Assert.fail("expected SFE");
} catch (SyntaxFailureException ex) {
// expected
}