@Override
  public boolean sendElectionMessage(int currentId, String content) {
    var candidateList = findElectionCandidateInstanceList(currentId);
    if (candidateList.isEmpty()) {
      return true;
    } else {
      var electionMessage = new Message(MessageType.ELECTION_INVOKE, "");
      candidateList.forEach((i) -> instanceMap.get(i).onMessage(electionMessage));
      return false;
    }
  }
@Test
  void testSendElectionMessageNotAccepted() {
    try {
      var instance1 = new BullyInstance(null, 1, 1);
      var instance2 = new BullyInstance(null, 1, 2);
      var instance3 = new BullyInstance(null, 1, 3);
      var instance4 = new BullyInstance(null, 1, 4);
      Map<Integer, Instance> instanceMap = Map.of(1, instance1, 2, instance2, 3, instance3, 4, instance4);
      instance1.setAlive(false);
      var messageManager = new BullyMessageManager(instanceMap);
      var result = messageManager.sendElectionMessage(3, "3");
      var instanceClass = AbstractInstance.class;
      var messageQueueField = instanceClass.getDeclaredField("messageQueue");
      messageQueueField.setAccessible(true);
      var message2 = ((Queue<Message>) messageQueueField.get(instance2)).poll();
      var instance4QueueSize = ((Queue<Message>) messageQueueField.get(instance4)).size();
      var expectedMessage = new Message(MessageType.ELECTION_INVOKE, "");
      assertEquals(message2, expectedMessage);
      assertEquals(instance4QueueSize, 0);
      assertFalse(result);
    } catch (IllegalAccessException | NoSuchFieldException e) {
      fail("Error to access private field.");
    }
  }