Source:
<code>public void secondMembershipPausesForLocatorWaitTime() throws IOException, MemberStartupException { final MembershipLocator<MemberIdentifier> coordinatorLocator = createLocator(0); coordinatorLocator.start(); final int coordinatorLocatorPort = coordinatorLocator.getPort(); final Membership<MemberIdentifier> coordinatorMembership = createMembership(coordinatorLocator, coordinatorLocatorPort); final MembershipLocator<MemberIdentifier> lateJoiningLocator = createLocator(0); lateJoiningLocator.start(); final int lateJoiningLocatorPort = lateJoiningLocator.getPort(); final int[] lateJoiningMembershipLocatorPorts = new int[] {coordinatorLocatorPort, lateJoiningLocatorPort}; final Duration minimumJoinWaitTime = Duration .ofMillis(2_000) .multipliedBy(lateJoiningMembershipLocatorPorts.length * 2); final int locatorWaitTime = (int) (3 * minimumJoinWaitTime.getSeconds()); final MembershipConfig lateJoiningMembershipConfig = createMembershipConfig(true, locatorWaitTime, lateJoiningMembershipLocatorPorts); final Membership<MemberIdentifier> lateJoiningMembership = createMembership(lateJoiningMembershipConfig, lateJoiningLocator); CompletableFuture<Void> lateJoiningMembershipStartup = executorServiceRule.runAsync(() -> { try { start(lateJoiningMembership); } catch (MemberStartupException e) { <START> e.printStackTrace(); <END> } }); CompletableFuture<Void> coordinatorMembershipStartup = executorServiceRule.runAsync(() -> { try { Thread.sleep(2 * minimumJoinWaitTime.toMillis()); start(coordinatorMembership); } catch (MemberStartupException | InterruptedException e) { e.printStackTrace(); } }); await().untilAsserted(() -> assertThat(coordinatorMembershipStartup).isDone()); await().untilAsserted(() -> assertThat(lateJoiningMembershipStartup).isDone()); await().untilAsserted( () -> assertThat(coordinatorMembership.getView().getMembers()).hasSize(2)); await().untilAsserted( () -> assertThat(lateJoiningMembership.getView().getMembers()).hasSize(2)); stop(coordinatorMembership, lateJoiningMembership); stop(coordinatorLocator, lateJoiningLocator); }</code><technical_language>a couple of auto-generated try/catch statements in test. If failure conditions test fail? If not, good stack traces</technical_language>

Target:
public void secondMembershipPausesForLocatorWaitTime() throws IOException, MemberStartupException, InterruptedException { final MembershipLocator<MemberIdentifier> coordinatorLocator = createLocator(0); coordinatorLocator.start(); final int coordinatorLocatorPort = coordinatorLocator.getPort(); final Membership<MemberIdentifier> coordinatorMembership = createMembership(coordinatorLocator, coordinatorLocatorPort); final MembershipLocator<MemberIdentifier> lateJoiningLocator = createLocator(0); lateJoiningLocator.start(); final int lateJoiningLocatorPort = lateJoiningLocator.getPort(); final int[] locatorPorts = new int[] {coordinatorLocatorPort, lateJoiningLocatorPort}; final Duration minimumJoinWaitTime = Duration .ofMillis(JOIN_RETRY_SLEEP + FIND_LOCATOR_RETRY_SLEEP) .multipliedBy(getMinimumRetriesBeforeBecomingCoordinator(locatorPorts.length)); final int locatorWaitTime = (int) (10 * minimumJoinWaitTime.getSeconds()); final MembershipConfig lateJoiningMembershipConfig = createMembershipConfig(true, locatorWaitTime, locatorPorts); final Membership<MemberIdentifier> lateJoiningMembership = createMembership(lateJoiningMembershipConfig, lateJoiningLocator); CompletableFuture<Void> lateJoiningMembershipStartup = executorServiceRule.runAsync(() -> { try { start(lateJoiningMembership); } catch (MemberStartupException e) { throw new RuntimeException(e); } }); Thread.sleep(2 * minimumJoinWaitTime.toMillis()); start(coordinatorMembership); await().untilAsserted(() -> assertThat(lateJoiningMembershipStartup).isCompleted()); await().untilAsserted( () -> assertThat(coordinatorMembership.getView().getMembers()).hasSize(2)); await().untilAsserted( () -> assertThat(lateJoiningMembership.getView().getMembers()).hasSize(2)); stop(coordinatorMembership, lateJoiningMembership); stop(coordinatorLocator, lateJoiningLocator); }