mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-09 04:21:08 +01:00
Call XMPPConnection.sendIqRequestAndWaitForResponse(IQ) where possible
Refactored using find . -type f -name "*.java" |\ xargs sed -i -E |\ 's/\.createStanzaCollectorAndSend\((\w+)\)\.nextResultOrThrow\(\);/.sendIqRequestAndWaitForResponse(\1);/' and some manual refactoring.
This commit is contained in:
parent
c9ea1c11b6
commit
aab48570c9
53 changed files with 206 additions and 188 deletions
|
|
@ -129,6 +129,17 @@ public class ConnectionUtils {
|
|||
when(collector.nextResultOrThrow()).thenAnswer(answerOrThrow);
|
||||
when(collector.nextResultOrThrow(anyLong())).thenAnswer(answerOrThrow);
|
||||
|
||||
Answer<IQ> responseIq = new Answer<IQ>() {
|
||||
@Override
|
||||
public IQ answer(InvocationOnMock invocation) throws Throwable {
|
||||
collectorAndSend.answer(invocation);
|
||||
|
||||
IQ response = (IQ) answerOrThrow.answer(invocation);
|
||||
return response;
|
||||
}
|
||||
};
|
||||
when(connection.sendIqRequestAndWaitForResponse(isA(IQ.class))).thenAnswer(responseIq);
|
||||
|
||||
// initialize service discovery manager for this connection
|
||||
ServiceDiscoveryManager.getInstanceFor(connection);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue