use of com.squarespace.template.Instructions.AlternatesWithInst in project template-compiler by Squarespace.
the class InstructionEqualityTest method testAlternatesWithEquals.
@Test
public void testAlternatesWithEquals() throws CodeSyntaxException {
CodeMaker mk = maker();
AlternatesWithInst a1 = mk.alternates();
AlternatesWithInst a2 = mk.alternates();
assertEquals(a1, a2);
assertFalse(a1.equals(null));
a1.getConsequent().add(mk.text("foo"));
assertNotEquals(a1, a2);
assertNotEquals(a1, mk.section("foo"));
assertNotEquals(a1, mk.end());
a2.getConsequent().add(mk.text("foo"));
assertEquals(a1, a2);
a1.setAlternative(mk.text("bar"));
assertNotEquals(a1, a2);
assertNotEquals(a1, mk.section("foo"));
assertNotEquals(a1, mk.end());
a2.setAlternative(mk.text("bar"));
assertEquals(a1, a2);
}
Aggregations