@Test
public void updateMeWritingShouldUpdateMeAndNotifyOthersOnlyWhenStateChanges() {

    assertFalse(me.isWriting());
    // Not writing - nothing happens
    controller.updateMeWriting(false);
    verifyZeroInteractions(networkMessages);
    assertFalse(me.isWriting());
    // Wrote something - notify others and update me
    controller.updateMeWriting(true);
    verify(networkMessages).sendWritingMessage();
    assertTrue(me.isWriting());
    // Continues to write - nothing happens
    controller.updateMeWriting(true);
    verifyNoMoreInteractions(networkMessages);
    assertTrue(me.isWriting());
    // Stopped writing - notify others and update me
    controller.updateMeWriting(false);
    verify(networkMessages).sendStoppedWritingMessage();
    assertFalse(me.isWriting());
    // Still not writing - nothing happens
    controller.updateMeWriting(false);
    verifyNoMoreInteractions(networkMessages);
    assertFalse(me.isWriting());
}