@Test public void testMemberChangeEventLogging() { ClusterMembershipRevision<ClusterMember> revision = clusterMemberRegistrationRevision(activeClusterMember("local")); String value = ClusterMembershipTransactionLogger.doFormat(ClusterMembershipEvent.memberAddedEvent(revision)); assertThat(value).isEqualTo("eventType=[membership] memberId=local active=true registered=true enabled=true memberRevision=0 leadershipState=n/a leadershipRevision=n/a"); }
@VisibleForTesting static String doFormat(ClusterMembershipEvent event) { if (event instanceof ClusterMembershipChangeEvent) { return doFormat((ClusterMembershipChangeEvent) event); } if (event instanceof LeaderElectionChangeEvent) { return doFormat((LeaderElectionChangeEvent) event); } return null; }
ClusterMembershipTransactionLogger { @VisibleForTesting static String doFormat(ClusterMembershipEvent event) { if (event instanceof ClusterMembershipChangeEvent) { return doFormat((ClusterMembershipChangeEvent) event); } if (event instanceof LeaderElectionChangeEvent) { return doFormat((LeaderElectionChangeEvent) event); } return null; } }
ClusterMembershipTransactionLogger { @VisibleForTesting static String doFormat(ClusterMembershipEvent event) { if (event instanceof ClusterMembershipChangeEvent) { return doFormat((ClusterMembershipChangeEvent) event); } if (event instanceof LeaderElectionChangeEvent) { return doFormat((LeaderElectionChangeEvent) event); } return null; }  }
ClusterMembershipTransactionLogger { @VisibleForTesting static String doFormat(ClusterMembershipEvent event) { if (event instanceof ClusterMembershipChangeEvent) { return doFormat((ClusterMembershipChangeEvent) event); } if (event instanceof LeaderElectionChangeEvent) { return doFormat((LeaderElectionChangeEvent) event); } return null; }   }
ClusterMembershipTransactionLogger { @VisibleForTesting static String doFormat(ClusterMembershipEvent event) { if (event instanceof ClusterMembershipChangeEvent) { return doFormat((ClusterMembershipChangeEvent) event); } if (event instanceof LeaderElectionChangeEvent) { return doFormat((LeaderElectionChangeEvent) event); } return null; }    }