ClusterMasterExecutorImpl implements ClusterMasterExecutor { protected void notifyMasterTokenTransitionListeners( boolean masterTokenAcquired) { for (ClusterMasterTokenTransitionListener clusterMasterTokenTransitionListener : _clusterMasterTokenTransitionListeners) { if (masterTokenAcquired) { clusterMasterTokenTransitionListener.masterTokenAcquired(); } else { clusterMasterTokenTransitionListener.masterTokenReleased(); } } }  @Override void addClusterMasterTokenTransitionListener(
		ClusterMasterTokenTransitionListener
			clusterMasterTokenTransitionListener); @Override NoticeableFuture<T> executeOnMaster(
		MethodHandler methodHandler); @Override boolean isEnabled(); @Override boolean isMaster(); @Override void removeClusterMasterTokenTransitionListener(
		ClusterMasterTokenTransitionListener
			clusterMasterTokenTransitionListener);  }
@Test public void testNotifyMasterTokenTransitionListeners() { ClusterMasterExecutorImpl clusterMasterExecutorImpl = new ClusterMasterExecutorImpl(); MockClusterMasterTokenTransitionListener mockClusterMasterTokenTransitionListener = new MockClusterMasterTokenTransitionListener(); clusterMasterExecutorImpl.addClusterMasterTokenTransitionListener( mockClusterMasterTokenTransitionListener); clusterMasterExecutorImpl.notifyMasterTokenTransitionListeners(true); Assert.assertTrue( mockClusterMasterTokenTransitionListener. isMasterTokenAcquiredNotified()); Assert.assertFalse( mockClusterMasterTokenTransitionListener. isMasterTokenReleasedNotified()); clusterMasterExecutorImpl = new ClusterMasterExecutorImpl(); mockClusterMasterTokenTransitionListener = new MockClusterMasterTokenTransitionListener(); clusterMasterExecutorImpl.addClusterMasterTokenTransitionListener( mockClusterMasterTokenTransitionListener); clusterMasterExecutorImpl.notifyMasterTokenTransitionListeners(false); Assert.assertFalse( mockClusterMasterTokenTransitionListener. isMasterTokenAcquiredNotified()); Assert.assertTrue( mockClusterMasterTokenTransitionListener. isMasterTokenReleasedNotified()); }