package com.tisawesomeness.minecord.util.discord;

import com.tisawesomeness.minecord.testutil.Resources;

import com.fasterxml.jackson.core.JsonProcessingException;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;

import static org.assertj.core.api.Assertions.assertThat;

public class PresenceSwitcherTest {

    private static PresenceSwitcher switcher;

    @BeforeAll
    private static void initConfig() throws JsonProcessingException {
        switcher = new PresenceSwitcher(Resources.branding().getPresenceConfig());
    }

    @ParameterizedTest(name = "{index} ==> The switcher updates the current for behavior {0}")
    @EnumSource
    public void test(PresenceBehavior behavior) {
        assertThat(behavior.switchPresence(switcher)).isEqualTo(switcher.current());
    }

}

@@ -83,126 +83,472 @@
 ord.
-testutil.Resources;%0A%0Aimport com.fasterxml.jackson.core.JsonProcessingException;%0Aimport org.junit.jupiter.api.BeforeAll
+config.branding.Presence;%0Aimport com.tisawesomeness.minecord.config.branding.PresenceConfig;%0Aimport com.tisawesomeness.minecord.testutil.Reflect;%0Aimport com.tisawesomeness.minecord.testutil.Resources;%0Aimport com.tisawesomeness.minecord.util.Lists;%0A%0Aimport com.fasterxml.jackson.core.JsonProcessingException;%0Aimport net.dv8tion.jda.api.OnlineStatus;%0Aimport org.junit.jupiter.api.BeforeAll;%0Aimport org.junit.jupiter.api.DisplayName;%0Aimport org.junit.jupiter.api.Test
 ;%0Aim
@@ -650,16 +650,40 @@
 ource;%0A%0A
+import java.util.List;%0A%0A
 import s
@@ -1087,16 +1087,111 @@
 r %7B0%7D%22)%0A
+    @DisplayName(%22A presence switcher with one presence always switches to the same presence%22)%0A
     @Enu
@@ -1218,16 +1218,27 @@
 oid test
+OnePresence
 (Presenc
@@ -1351,10 +1351,1057 @@
 %0A    %7D%0A%0A
+    @Test%0A    @DisplayName(%22A presence switcher with two presences alternates between presences when random unique%22)%0A    public void testRandomUniqueAlternate() throws JsonProcessingException, NoSuchFieldException %7B%0A        Presence presence1 = new Presence(OnlineStatus.ONLINE, PresenceType.PLAYING, %221%22, null, 1);%0A        Presence presence2 = new Presence(OnlineStatus.ONLINE, PresenceType.PLAYING, %222%22, null, 1);%0A        List%3CPresence%3E list = Lists.of(presence1, presence2);%0A%0A        PresenceConfig config = Resources.branding().getPresenceConfig();%0A        Reflect.setField(config, %22presences%22, list);%0A        PresenceSwitcher switcher = new PresenceSwitcher(config);%0A%0A        Presence switchedPresence1 = PresenceBehavior.RANDOM_UNIQUE.switchPresence(switcher);%0A        assertThat(list).contains(switchedPresence1);%0A        Presence switchedPresence2 = PresenceBehavior.RANDOM_UNIQUE.switchPresence(switcher);%0A        assertThat(list).contains(switchedPresence2);%0A        assertThat(switchedPresence2).isNotEqualTo(switchedPresence1);%0A    %7D%0A%0A
 %7D%0A

Test random unique presence switching