1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-29 15:32:06 +01:00

Merge pull request #585 from guusdk/sint_assertequals-argument-order

[sinttest]: Fix order of arguments in assertEquals()
This commit is contained in:
Florian Schmaus 2024-04-10 14:58:34 +00:00 committed by GitHub
commit 6b300ec279
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 15 additions and 14 deletions

View file

@ -354,7 +354,7 @@ public class AdHocCommandIntegrationTest extends AbstractSmackIntegrationTest {
SubmitForm submitForm = form.getSubmitForm(); SubmitForm submitForm = form.getSubmitForm();
XMPPErrorException exception = assertThrows(XMPPErrorException.class, () -> command.next(submitForm)); XMPPErrorException exception = assertThrows(XMPPErrorException.class, () -> command.next(submitForm));
assertEquals(exception.getStanzaError().getCondition(), StanzaError.Condition.bad_request, assertEquals(StanzaError.Condition.bad_request, exception.getStanzaError().getCondition(),
"Unexpected error condition received after " + conTwo.getUser() + " supplied an invalid argument " + "Unexpected error condition received after " + conTwo.getUser() + " supplied an invalid argument " +
"to the command node '" + commandNode + "' of " + conOne.getUser()); "to the command node '" + commandNode + "' of " + conOne.getUser());
} finally { } finally {

View file

@ -185,7 +185,7 @@ public class MultiUserChatEntityIntegrationTest extends AbstractMultiUserChatInt
expectedCondition = StanzaError.Condition.not_acceptable; expectedCondition = StanzaError.Condition.not_acceptable;
break; break;
} }
assertEquals(xe.getStanzaError().getCondition(), expectedCondition, assertEquals(expectedCondition, xe.getStanzaError().getCondition(),
"Unexpected error condition in error returned when " + conTwo.getUser() + " was trying to discover items of " + mucAsSeenByOneUserJid); "Unexpected error condition in error returned when " + conTwo.getUser() + " was trying to discover items of " + mucAsSeenByOneUserJid);
} }
} }

View file

@ -614,7 +614,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
XMPPException.XMPPErrorException xe = assertThrows(XMPPException.XMPPErrorException.class, XMPPException.XMPPErrorException xe = assertThrows(XMPPException.XMPPErrorException.class,
() -> mucAsSeenByTwo.revokeVoice(nicknameOne), () -> mucAsSeenByTwo.revokeVoice(nicknameOne),
"Expected an XMPP error when " + conTwo.getUser() + " was trying to revoke the 'voice' privilege of " + conOne.getUser() + " in room " + mucAddress); "Expected an XMPP error when " + conTwo.getUser() + " was trying to revoke the 'voice' privilege of " + conOne.getUser() + " in room " + mucAddress);
assertEquals(xe.getStanzaError().getCondition().toString(), "not-allowed", "Unexpected stanza error condition in error returned when " + conTwo.getUser() + " was trying to revoke the 'voice' privilege of " + conOne.getUser() + " in room " + mucAddress); assertEquals("not-allowed", xe.getStanzaError().getCondition().toString(), "Unexpected stanza error condition in error returned when " + conTwo.getUser() + " was trying to revoke the 'voice' privilege of " + conOne.getUser() + " in room " + mucAddress);
} finally { } finally {
tryDestroy(mucAsSeenByOne); tryDestroy(mucAsSeenByOne);
} }
@ -661,9 +661,9 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
XMPPException.XMPPErrorException xe3 = assertThrows(XMPPException.XMPPErrorException.class, XMPPException.XMPPErrorException xe3 = assertThrows(XMPPException.XMPPErrorException.class,
() -> mucAsSeenByThree.revokeModerator(nicknameTwo), () -> mucAsSeenByThree.revokeModerator(nicknameTwo),
"Expected an XMPP error when " + conThree.getUser() + " (a moderator) was trying to revoke the 'moderator' role of " + conTwo.getUser() + " (an admin) in room " + mucAddress); "Expected an XMPP error when " + conThree.getUser() + " (a moderator) was trying to revoke the 'moderator' role of " + conTwo.getUser() + " (an admin) in room " + mucAddress);
assertEquals(xe1.getStanzaError().getCondition().toString(), "not-allowed", "Unexpected condition in XMPP error when " + conTwo.getUser() + " (an admin) was trying to revoke the 'moderator' role of " + conOne.getUser() + " (an owner) in room " + mucAddress); assertEquals("not-allowed", xe1.getStanzaError().getCondition().toString(), "Unexpected condition in XMPP error when " + conTwo.getUser() + " (an admin) was trying to revoke the 'moderator' role of " + conOne.getUser() + " (an owner) in room " + mucAddress);
assertEquals(xe2.getStanzaError().getCondition().toString(), "not-allowed", "Unexpected condition in XMPP error when " + conThree.getUser() + " (a moderator) was trying to revoke the 'moderator' role of " + conOne.getUser() + " (an owner) in room " + mucAddress); assertEquals("not-allowed", xe2.getStanzaError().getCondition().toString(), "Unexpected condition in XMPP error when " + conThree.getUser() + " (a moderator) was trying to revoke the 'moderator' role of " + conOne.getUser() + " (an owner) in room " + mucAddress);
assertEquals(xe3.getStanzaError().getCondition().toString(), "not-allowed", "Unexpected condition in XMPP error when " + conThree.getUser() + " (a moderator) was trying to revoke the 'moderator' role of " + conTwo.getUser() + " (an admin) in room " + mucAddress); assertEquals("not-allowed", xe3.getStanzaError().getCondition().toString(), "Unexpected condition in XMPP error when " + conThree.getUser() + " (a moderator) was trying to revoke the 'moderator' role of " + conTwo.getUser() + " (an admin) in room " + mucAddress);
} finally { } finally {
tryDestroy(mucAsSeenByOne); tryDestroy(mucAsSeenByOne);
} }
@ -702,7 +702,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
mucAsSeenByOne.grantAdmin(conTwo.getUser().asBareJid()); mucAsSeenByOne.grantAdmin(conTwo.getUser().asBareJid());
resultSyncPoint.waitForResult(timeout); resultSyncPoint.waitForResult(timeout);
assertEquals(mucAsSeenByOne.getOccupantsCount(), 3, "Unexpected occupant count in room " + mucAddress); assertEquals(3, mucAsSeenByOne.getOccupantsCount(), "Unexpected occupant count in room " + mucAddress);
assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(JidCreate.entityFullFrom(mucAddress, nicknameOne)).getRole(), assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(JidCreate.entityFullFrom(mucAddress, nicknameOne)).getRole(),
"Unexpected role for occupant " + nicknameOne + " of " + mucAddress); "Unexpected role for occupant " + nicknameOne + " of " + mucAddress);
assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(JidCreate.entityFullFrom(mucAddress, nicknameTwo)).getRole(), assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(JidCreate.entityFullFrom(mucAddress, nicknameTwo)).getRole(),
@ -758,7 +758,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
mucAsSeenByOne.grantAdmin(conTwo.getUser().asBareJid()); mucAsSeenByOne.grantAdmin(conTwo.getUser().asBareJid());
resultSyncPoint.waitForResult(timeout); resultSyncPoint.waitForResult(timeout);
assertEquals(mucAsSeenByOne.getOccupantsCount(), 3, "Unexpected occupant count in room " + mucAddress); assertEquals(3, mucAsSeenByOne.getOccupantsCount(), "Unexpected occupant count in room " + mucAddress);
assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(JidCreate.entityFullFrom(mucAddress, nicknameOne)).getRole(), assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(JidCreate.entityFullFrom(mucAddress, nicknameOne)).getRole(),
"Unexpected role for occupant " + nicknameOne + " of " + mucAddress); "Unexpected role for occupant " + nicknameOne + " of " + mucAddress);
assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(JidCreate.entityFullFrom(mucAddress, nicknameTwo)).getRole(), assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(JidCreate.entityFullFrom(mucAddress, nicknameTwo)).getRole(),
@ -810,7 +810,7 @@ public class MultiUserChatRolesAffiliationsPrivilegesIntegrationTest extends Abs
mucAsSeenByThree.join(nicknameThree); mucAsSeenByThree.join(nicknameThree);
mucAsSeenByOne.grantAdmin(conTwo.getUser().asBareJid()); mucAsSeenByOne.grantAdmin(conTwo.getUser().asBareJid());
adminResultSyncPoint.waitForResult(timeout); adminResultSyncPoint.waitForResult(timeout);
assertEquals(mucAsSeenByOne.getOccupantsCount(), 3, "Unexpected occupant count in room " + mucAddress); assertEquals(3, mucAsSeenByOne.getOccupantsCount(), "Unexpected occupant count in room " + mucAddress);
assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(jidOne).getRole(), "Unexpected role for occupant " + jidOne + " in room " + mucAddress); assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(jidOne).getRole(), "Unexpected role for occupant " + jidOne + " in room " + mucAddress);
assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(jidTwo).getRole(), "Unexpected role for occupant " + jidTwo + " in room " + mucAddress); assertEquals(MUCRole.moderator, mucAsSeenByOne.getOccupant(jidTwo).getRole(), "Unexpected role for occupant " + jidTwo + " in room " + mucAddress);
assertEquals(MUCRole.participant, mucAsSeenByOne.getOccupant(jidThree).getRole(), "Unexpected role for occupant " + jidThree + " in room " + mucAddress); assertEquals(MUCRole.participant, mucAsSeenByOne.getOccupant(jidThree).getRole(), "Unexpected role for occupant " + jidThree + " in room " + mucAddress);

View file

@ -148,8 +148,9 @@ public class FormTest extends AbstractSmackIntegrationTest {
assertNotNull(completedForm2.getField("name")); assertNotNull(completedForm2.getField("name"));
assertNotNull(completedForm2.getField("description")); assertNotNull(completedForm2.getField("description"));
assertEquals( assertEquals(
completedForm2.getField("name").getValues().get(0).toString(), "Credit card number invalid",
"Credit card number invalid"); completedForm2.getField("name").getValues().get(0).toString()
);
assertNotNull(completedForm2.getField("time")); assertNotNull(completedForm2.getField("time"));
assertNotNull(completedForm2.getField("age")); assertNotNull(completedForm2.getField("age"));
assertEquals("20", completedForm2.getField("age").getValues().get(0).toString(), "The age is bad"); assertEquals("20", completedForm2.getField("age").getValues().get(0).toString(), "The age is bad");

View file

@ -99,7 +99,7 @@ public class STUNResolverTest extends SmackTestCase {
stunResolver.addCandidate(cand3); stunResolver.addCandidate(cand3);
stunResolver.addCandidate(cand4); stunResolver.addCandidate(cand4);
assertEquals(stunResolver.getPreferredCandidate(), candH); assertEquals(candH, stunResolver.getPreferredCandidate());
} }
/** /**
@ -127,7 +127,7 @@ public class STUNResolverTest extends SmackTestCase {
iceResolver.addCandidate(cand3); iceResolver.addCandidate(cand3);
iceResolver.addCandidate(cand4); iceResolver.addCandidate(cand4);
assertEquals(iceResolver.getPreferredCandidate(), candH); assertEquals(candH, iceResolver.getPreferredCandidate());
} }
/** /**

View file

@ -65,7 +65,7 @@ public class TransportCandidateTest extends SmackTestCase {
candList.add(cand4); candList.add(cand4);
Collections.sort(candList); Collections.sort(candList);
assertEquals(candList.get(candList.size() - 1), candH); assertEquals(candH, candList.get(candList.size() - 1));
} }
protected int getMaxConnections() { protected int getMaxConnections() {