mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 05:52:06 +01:00
Add SynchronizationPoint.getFailureException()
This commit is contained in:
parent
fc9748b567
commit
525feaa161
2 changed files with 15 additions and 1 deletions
|
@ -226,6 +226,16 @@ public class SynchronizationPoint<E extends Exception> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public E getFailureException() {
|
||||||
|
connectionLock.lock();
|
||||||
|
try {
|
||||||
|
return failureException;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
connectionLock.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait for the condition to become something else as {@link State#RequestSent} or {@link State#Initial}.
|
* Wait for the condition to become something else as {@link State#RequestSent} or {@link State#Initial}.
|
||||||
* {@link #reportSuccess()}, {@link #reportFailure()} and {@link #reportFailure(Exception)} will either set this
|
* {@link #reportSuccess()}, {@link #reportFailure()} and {@link #reportFailure(Exception)} will either set this
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright 2015 Florian Schmaus
|
* Copyright 2015-2017 Florian Schmaus
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -40,6 +40,10 @@ public class WaitForClosingStreamElementTest extends AbstractSmackLowLevelIntegr
|
||||||
Field closingStreamReceivedField = connection.getClass().getDeclaredField("closingStreamReceived");
|
Field closingStreamReceivedField = connection.getClass().getDeclaredField("closingStreamReceived");
|
||||||
closingStreamReceivedField.setAccessible(true);
|
closingStreamReceivedField.setAccessible(true);
|
||||||
SynchronizationPoint<?> closingStreamReceived = (SynchronizationPoint<?>) closingStreamReceivedField.get(connection);
|
SynchronizationPoint<?> closingStreamReceived = (SynchronizationPoint<?>) closingStreamReceivedField.get(connection);
|
||||||
|
Exception failureException = closingStreamReceived.getFailureException();
|
||||||
|
if (failureException != null) {
|
||||||
|
throw new AssertionError("Sync poing yielded failure exception", failureException);
|
||||||
|
}
|
||||||
assertTrue(closingStreamReceived.wasSuccessful());
|
assertTrue(closingStreamReceived.wasSuccessful());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue