Smack icon indicating copy to clipboard operation
Smack copied to clipboard

Additional tests covering s7 of XEP-0045

Open Fishbowler opened this issue 3 years ago • 5 comments

Follows #475, #477 and #478. Draft until they're merged.

Fishbowler avatar Jul 07 '21 18:07 Fishbowler

This morning I rebased this branch to Fishbowler:xep-0045-coverage-part3

evdherberg avatar Jul 15 '21 10:07 evdherberg

@Flowdalic My rebase may have cleared out your earlier comments, which is unfortunate. I remember one about using enums, probably for error types. Do you remember the other one?

evdherberg avatar Jul 15 '21 11:07 evdherberg

The are still at the commit where I made them (which was "dropped" by you force pushing): https://github.com/igniterealtime/Smack/commit/65dee17f78edd98525fe172adc2bd6c21e2cb56c

Flowdalic avatar Jul 15 '21 11:07 Flowdalic

Not directly related to this PR, but the following pattern repeats over and over in the MUC integration tests

        EntityBareJid mucAddress = getRandomRoom("smack-inttest-discoinfo");
        MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
        createMuc(mucAsSeenByOne, Resourcepart.from("one-" + randomString));

which suggests that we can add a convenience method to reduce the boilerplate code. I thnk of

public MultiUserChat createMuc(MultiUserChatManager manager, String roomnameComponent) {
…
}

which, for example, determines the nickname prefix (one-, two-) by the provided manager.

I've had a play with this, but we regularly need mucAsSeenByOne later in the test. You could wrap the first two lines and return the MultiUserChat, but you couldn't use it if you needed a mucAsSeenByTwo, or you'd need to get the JID from mucAsSeenByOne, and we'd save no lines and reduce complexity even less.

Fishbowler avatar Oct 19 '21 21:10 Fishbowler

I've had a play with this, but we regularly need mucAsSeenByOne later in the test. You could wrap the first two lines and return the MultiUserChat, but you couldn't use it if you needed a mucAsSeenByTwo, or you'd need to get the JID from mucAsSeenByOne, and we'd save no lines and reduce complexity even less.

How about?

MultiUserChat mucAsSeenByOne = createMuc(mucManagerOne, "smack-inttest-discoinfo");
MultiUserChat musAsSeenByTwo = getMuc(mucManagerTwo, mucAsSeenByOne);

Flowdalic avatar Oct 20 '21 07:10 Flowdalic

Not directly related to this PR, but the following pattern repeats over and over in the MUC integration tests

        EntityBareJid mucAddress = getRandomRoom("smack-inttest-discoinfo");
        MultiUserChat mucAsSeenByOne = mucManagerOne.getMultiUserChat(mucAddress);
        createMuc(mucAsSeenByOne, Resourcepart.from("one-" + randomString));

which suggests that we can add a convenience method to reduce the boilerplate code. I thnk of

public MultiUserChat createMuc(MultiUserChatManager manager, String roomnameComponent) {
…
}

which, for example, determines the nickname prefix (one-, two-) by the provided manager.

I've tried doing this, but it doesn't really work out most of the time. Many of the instance references that are removed by such a method are needed elsewhere in the unit test implementation (for example in the assertions) making the replacement effort rather moot.

guusdk avatar Apr 16 '24 08:04 guusdk

@Flowdalic - is there anything to be done to 'fix' the coveralls check (that's now reporting failure)?

guusdk avatar Apr 16 '24 14:04 guusdk

@Flowdalic - is there anything to be done to 'fix' the coveralls check (that's now reporting failure)?

I've now added a new unit test for the MultiResultSyncPoint util that was added in this PR. Hopefully, that makes the test coverage check happy again.

guusdk avatar Apr 16 '24 14:04 guusdk

Applied review feedback, and squashed ~3 years of commits into one.

guusdk avatar Apr 26 '24 09:04 guusdk