From 901d7b39c559faba07a09215ca73bbc757cfae0c Mon Sep 17 00:00:00 2001 From: vanitasvitae Date: Wed, 9 Aug 2017 18:36:54 +0200 Subject: [PATCH] Test isReceiving, isSending --- .../jivesoftware/smackx/jingle/component/JingleContent.java | 4 ++-- .../smackx/jingle/component/JingleContentTest.java | 2 ++ .../smackx/jingle/component/JingleSessionTest.java | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/component/JingleContent.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/component/JingleContent.java index 5b11907f9..e0e006105 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/component/JingleContent.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/component/JingleContent.java @@ -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; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/component/JingleContentTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/component/JingleContentTest.java index f14d3747f..305f45d41 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/component/JingleContentTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/component/JingleContentTest.java @@ -38,4 +38,6 @@ public class JingleContentTest extends SmackTestSuite { assertNotNull(content.getName()); //MUST NOT BE NULL! assertEquals(0, content.getTransportBlacklist().size()); } + + } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/component/JingleSessionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/component/JingleSessionTest.java index 93496b4db..641eeec78 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/component/JingleSessionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/component/JingleSessionTest.java @@ -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)