aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/me/xmrvizzy/skyblocker/skyblock/dungeon/AcceptRepartyTest.java
blob: eb867a375b5a225e93fd94e1dcda36f321474ab8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package me.xmrvizzy.skyblocker.skyblock.dungeon;

import me.xmrvizzy.skyblocker.utils.chat.ChatPatternListenerTest;
import org.junit.jupiter.api.Test;

import java.util.regex.Matcher;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class AcceptRepartyTest extends ChatPatternListenerTest<Reparty> {

    public AcceptRepartyTest() { super(new Reparty()); }

    protected void assertGroup(String message, String group, String expect) {
        Matcher matcher = matcher(message);
        assertTrue(matcher.matches());
        assertEquals(expect, matcher.group(group));
    }

    @Test
    void testDisband() {
        assertGroup("[VIP+] KoloiYolo has disbanded the party!",
                /* group: */ "disband",
                /* expect: */ "KoloiYolo");
    }

    @Test
    void testInvite() {
        assertGroup("-----------------------------------------------------" +
                        "\n[MVP+] 1wolvesgaming has invited you to join their party!" +
                        "\nYou have 60 seconds to accept. Click here to join!" +
                        "\n-----------------------------------------------------",
                /* group: */ "invite",
                /* expect: */ "1wolvesgaming");
    }
}