### Question:
EventFilterChain implements EventSink { public synchronized void add_filter(EventFilter f) { Ensure.not_null(f); Ensure.is_false(f.locked()); f.connect(first()); m_filters.add(f); f.lock(m_filters); } EventFilterChain(EventSink sink); synchronized EventSink chain_sink(); synchronized List<EventFilter> filters(); synchronized void add_filter(EventFilter f); synchronized void remove_filter(EventFilter f); synchronized void clear(); @Override synchronized void sink(BusData data); synchronized EventFilterChainInfo info();  }### Answer:
@Test(expected = AssertionError.class) public void adding_null_filter_to_chain() throws Exception { m_chain.add_filter(null); }
@Test(expected = AssertionError.class) public void adding_filter_twice_to_same_chain() throws Exception { m_chain.add_filter(m_filter); m_chain.add_filter(m_filter); }
@Test(expected = AssertionError.class) public void adding_filter_in_another_chain() throws Exception { m_chain.add_filter(m_filter); new EventFilterChain(m_sink).add_filter(m_filter); }
@Test public void equals_and_hash_code() throws Exception { SaveSink ss = new SaveSink(); EventFilterChain c1 = new EventFilterChain(ss); EventFilterChain c2 = new EventFilterChain(ss); EventFilterChainInfo i1 = new EventFilterChainInfo(c1); EventFilterChainInfo i2 = new EventFilterChainInfo(c2); assertEquals(i1, i2); assertEquals(i1.hashCode(), i2.hashCode()); c1.add_filter(new TestEventFilter()); i1 = new EventFilterChainInfo(c1); assertFalse(i1.equals(i2)); assertNotSame(i1.hashCode(), i2.hashCode()); assertFalse(i1.equals(null)); assertFalse(i1.equals(new Integer(2))); assertTrue(i1.equals(i1)); }