Skip to content

Commit

Permalink
replacing asserts with test.await calls
Browse files Browse the repository at this point in the history
  • Loading branch information
lucianoviana committed Oct 4, 2024
1 parent 03a84d6 commit d1e2bab
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1246,12 +1246,12 @@ public void shouldHandleUserRequestMessages()
Thread.yield();
}

assertEquals(PASSWORD, auth.logonPassword());
assertEquals(PASSWORD, auth.userRequestPassword());
assertEquals(NEW_PASSWORD, auth.userRequestNewPassword());
assertEquals(1, auth.sessionId());
testSystem.await(() -> PASSWORD.equals(auth.logonPassword()));
testSystem.await(() -> PASSWORD.equals(auth.userRequestPassword()));
testSystem.await(() -> NEW_PASSWORD.equals(auth.userRequestNewPassword()));
testSystem.await(() -> 1 == auth.sessionId());

assertArchiveDoesNotContainPassword();
testSystem.await("unexpected result", this::assertArchiveDoesNotContainPassword);
}

@Test
Expand Down Expand Up @@ -1305,7 +1305,7 @@ private void exchangeLargeMessages()
}
}

private void assertArchiveDoesNotContainPassword()
private boolean assertArchiveDoesNotContainPassword()
{
final EngineConfiguration configuration = acceptingEngine.configuration();

Expand All @@ -1314,10 +1314,12 @@ private void assertArchiveDoesNotContainPassword()
assertThat(messages, hasSize(greaterThanOrEqualTo(1)));
for (final String message : messages)
{
assertThat(message + " contains the password",
message,
allOf(not(containsString(PASSWORD)), not(containsString(NEW_PASSWORD))));
if (!allOf(not(containsString(PASSWORD)), not(containsString(NEW_PASSWORD))).matches(message))
{
return false;
}
}
return true;
}

private void exchangeExecutionReport()
Expand Down

0 comments on commit d1e2bab

Please sign in to comment.