1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-05 03:35:59 +01:00

Test isReceiving, isSending

This commit is contained in:
vanitasvitae 2017-08-09 18:36:54 +02:00
parent f930c1bdc5
commit 901d7b39c5
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 8 additions and 2 deletions

View file

@ -372,13 +372,13 @@ public class JingleContent implements JingleTransportCallback, JingleSecurityCal
}
}
private boolean isSending() {
public boolean isSending() {
return (getSenders() == JingleContentElement.Senders.initiator && getParent().isInitiator()) ||
(getSenders() == JingleContentElement.Senders.responder && getParent().isResponder()) ||
getSenders() == JingleContentElement.Senders.both;
}
private boolean isReceiving() {
public boolean isReceiving() {
return (getSenders() == JingleContentElement.Senders.initiator && getParent().isResponder()) ||
(getSenders() == JingleContentElement.Senders.responder && getParent().isInitiator()) ||
getSenders() == JingleContentElement.Senders.both;

View file

@ -38,4 +38,6 @@ public class JingleContentTest extends SmackTestSuite {
assertNotNull(content.getName()); //MUST NOT BE NULL!
assertEquals(0, content.getTransportBlacklist().size());
}
}

View file

@ -162,6 +162,8 @@ public class JingleSessionTest extends SmackTestSuite {
assertEquals(description.getElement().toXML().toString(), descriptionElement.toXML().toString());
assertNull(contentElement.getSecurity());
assertTrue(content.isSending());
assertFalse(content.isReceiving());
}
@Test(expected = IllegalArgumentException.class)
@ -236,6 +238,8 @@ public class JingleSessionTest extends SmackTestSuite {
assertEquals(session.getResponder(), accept.getResponder());
assertEquals(1, accept.getContents().size());
assertEquals(content.getName(), accept.getSoleContentOrThrow().getName());
assertFalse(content.isSending());
assertTrue(content.isReceiving());
}
@Test(expected = IllegalStateException.class)