WorldpayClusterInformationAppender implements WorldpaySupportEmailAppender { @Override public String appendContent() { StringBuilder clusterInformation = new StringBuilder(); clusterInformation.append(System.lineSeparator()).append("Cluster Information:").append(System.lineSeparator()); final DefaultBroadcastService broadcastService = getBroadCastServiceInstance(); clusterInformation.append(ONE_TAB).append("Clustering Enabled: ").append(broadcastService.isClusteringEnabled()).append(System.lineSeparator()); clusterInformation.append(ONE_TAB).append("Cluster Node Id: ").append(broadcastService.getClusterNodeID()).append(System.lineSeparator()); clusterInformation.append(ONE_TAB).append("Cluster Island Id: ").append(broadcastService.getClusterIslandPK()).append(System.lineSeparator()); return clusterInformation.toString(); }  @Override String appendContent();  }
@Test public void testAppendContent() throws Exception { doReturn(broadcastServiceMock).when(testObj).getBroadCastServiceInstance(); when(broadcastServiceMock.getClusterIslandPK()).thenReturn(CLUSTER_ISLAND_ID); when(broadcastServiceMock.getClusterNodeID()).thenReturn(CLUSTER_NODE_ID); when(broadcastServiceMock.isClusteringEnabled()).thenReturn(Boolean.TRUE); final String result = testObj.appendContent(); assertTrue(result.contains("Cluster Information:")); assertTrue(result.contains(String.valueOf(Boolean.TRUE))); assertTrue(result.contains(String.valueOf(CLUSTER_ISLAND_ID))); assertTrue(result.contains(String.valueOf(CLUSTER_NODE_ID))); }