### Question:
EventFilter implements EventSink { public synchronized void connect(EventSink s) { Ensure.is_true(m_sink == null || s == null); Ensure.is_null(m_lock); m_sink = s; } EventFilter(); synchronized void connect(EventSink s); synchronized EventSink connected(); EventFilterInfo info(); synchronized void lock(Object l); synchronized void unlock(Object l); synchronized boolean locked();  }### Answer:
@Test public void forwarding_with_sink_set() throws Exception { m_filter.connect(m_sink); m_filter.m_forward = true; BusData d = bus_data(); m_filter.sink(d); assertEquals(1, m_sink.m_data.size()); assertSame(d, m_sink.m_data.get(0)); }
@Test(expected = AssertionError.class) public void setting_sink_with_sink_already_set() throws Exception { m_filter.connect(m_sink); m_filter.connect(m_sink); }
@Test public void resetting_sink_legally() throws Exception { m_filter.connect(m_sink); m_filter.connect(null); m_filter.connect(null); m_filter.connect(m_sink); }