### Question:
SyncScbSlave { public synchronized void sync_now_wait() { int prev_count = m_sync_count; do { sync_now(); try { wait(WAIT_FOR_SYNC_TIME_MS); } catch (InterruptedException e) { } } while (m_sync_count == prev_count); } SyncScbSlave(SyncScbMaster master, long poll_interval_ms); synchronized Date last_sync_date(); synchronized void sync_now(); synchronized void sync_now_wait(); synchronized SyncSlaveState state(); synchronized void add_container(String key, ScbEditableContainer<T> container,
			Class<ID_TYPE> idclass, Class<T> tclass); void shutdown();  }### Answer:
@Test public void local_changes_are_propagated_to_server_and_back() throws Exception { m_slave.sync_now_wait(); TestSyncScb s = new TestSyncScb(0, SyncStatus.UNKNOWN, "foo"); m_c0.add_scb(s); m_dispatcher_helper.wait_dispatch_clear(); assertEquals(1, m_c0.all_scbs().size()); assertEquals(SyncStatus.LOCAL_CHANGES, s.sync_status()); assertEquals(0, m_m0.all_scbs().size()); m_slave.sync_now_wait(); m_dispatcher_helper.wait_dispatch_clear(); assertEquals(1, m_m0.all_scbs().size()); assertEquals(1, m_c0.all_scbs().size()); assertEquals(SyncStatus.SYNCHRONIZED, s.sync_status()); assertEquals("foo", s.data()); TestSyncScb ss = m_m0.all_scbs().iterator().next(); assertEquals(SyncStatus.MASTER, ss.sync_status()); assertEquals("foo", ss.data()); s.data("bar"); m_dispatcher_helper.wait_dispatch_clear(); assertEquals(1, m_c0.all_scbs().size()); assertEquals(1, m_m0.all_scbs().size()); assertTrue(m_c0.all_scbs().contains(s)); assertTrue(m_m0.all_scbs().contains(ss)); assertEquals(SyncStatus.LOCAL_CHANGES, s.sync_status()); assertEquals(SyncStatus.MASTER, ss.sync_status()); assertEquals("bar", s.data()); assertEquals("foo", ss.data()); m_slave.sync_now_wait(); m_dispatcher_helper.wait_dispatch_clear(); assertEquals(1, m_c0.all_scbs().size()); assertEquals(1, m_m0.all_scbs().size()); assertTrue(m_c0.all_scbs().contains(s)); assertTrue(m_m0.all_scbs().contains(ss)); assertEquals(SyncStatus.SYNCHRONIZED, s.sync_status()); assertEquals(SyncStatus.MASTER, ss.sync_status()); assertEquals("bar", s.data()); assertEquals("bar", ss.data()); m_c0.remove_scb(s); m_dispatcher_helper.wait_dispatch_clear(); assertEquals(0, m_c0.all_scbs().size()); assertEquals(1, m_m0.all_scbs().size()); assertTrue(m_m0.all_scbs().contains(ss)); assertEquals(SyncStatus.MASTER, ss.sync_status()); assertEquals("bar", ss.data()); m_slave.sync_now_wait(); m_dispatcher_helper.wait_dispatch_clear(); assertEquals(0, m_c0.all_scbs().size()); assertEquals(0, m_m0.all_scbs().size()); }