Skip to content

Commit

Permalink
sint: Refactor SimpleResultSyncPoint to use Void
Browse files Browse the repository at this point in the history
The existing 'return type' of the class is Boolean. That, however, is effectively unused: the only two usages are modified in this class, and is unreachable code (as an exception would have been thrown).
  • Loading branch information
guusdk committed Apr 4, 2024
1 parent ca7983b commit e3c17ec
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

import org.junit.jupiter.api.Assertions;

public class SimpleResultSyncPoint extends ResultSyncPoint<Boolean, Exception> {
public class SimpleResultSyncPoint extends ResultSyncPoint<Void, Exception> {

public void signal() {
signal(Boolean.TRUE);
signal((Void) null);
}

public void signalFailure() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ public void presenceUnavailable(FullJid jid, Presence presence) {
// conOne.
conTwo.disconnect();

Boolean result = offlineTriggered.waitForResult(timeout);
if (!result) {
throw new Exception("presenceUnavailable() was not called");
}
SimpleResultSyncPoint.assertSuccess(offlineTriggered, timeout, "presenceUnavailable() was not called");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*/
package org.jivesoftware.smack.roster;

import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.Collection;
import java.util.concurrent.TimeoutException;

Expand Down Expand Up @@ -101,7 +99,7 @@ private void checkIfAddedAndSubscribed(Collection<Jid> addresses) {
try {
rosterOne.createItemAndRequestSubscription(conTwo.getUser().asBareJid(), conTwosRosterName, null);

assertTrue(addedAndSubscribed.waitForResult(2 * connection.getReplyTimeout()));
SimpleResultSyncPoint.assertSuccess(addedAndSubscribed, 2 * connection.getReplyTimeout(), "Did not receive expected roster item.");
}
finally {
rosterTwo.removeSubscribeListener(subscribeListener);
Expand Down

0 comments on commit e3c17ec

Please sign in to comment.