### Question:
BeginHeadingEvent extends DocumentBuilderEvent { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof BeginHeadingEvent)) { return false; } BeginHeadingEvent other = (BeginHeadingEvent) obj; return other.level == level; } BeginHeadingEvent(int level, Attributes attributes); @Override void invoke(DocumentBuilder builder); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }### Answer:
@Test public void equals() { assertEquality(new BeginHeadingEvent(2, new Attributes()), new BeginHeadingEvent(2, new Attributes())); assertInequality(new BeginHeadingEvent(2, new Attributes()), new BeginHeadingEvent(1, new Attributes())); }