mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-03-24 13:44:33 +00:00
[AB-215] adding create alias and delete alias commands to create service specific aliases for commands
renaming package in commands package defaulting to latest in docker compose build for deployment container fixing jacoco configuration changing that if there are no parameters required, parameters are accepted
This commit is contained in:
@@ -26,17 +26,12 @@ public class DeleteTrackedEmoteListenerTest {
|
||||
@Mock
|
||||
private EmoteDeletedModel model;
|
||||
|
||||
private static final Long SERVER_ID = 4L;
|
||||
private static final Long EMOTE_ID = 4L;
|
||||
|
||||
@Test
|
||||
public void testEmoteDeleted() {
|
||||
Emote emote = Mockito.mock(Emote.class);
|
||||
when(emote.getIdLong()).thenReturn(EMOTE_ID);
|
||||
when(model.getEmote()).thenReturn(emote);
|
||||
when(model.getServerId()).thenReturn(SERVER_ID);
|
||||
testUnit.execute(model);
|
||||
verify(trackedEmoteManagementService, times(1)).markAsDeleted(SERVER_ID, EMOTE_ID);
|
||||
verify(trackedEmoteManagementService, times(1)).markAsDeleted(emote);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -8,6 +8,8 @@ import dev.sheldan.abstracto.statistic.emote.service.TrackedEmoteService;
|
||||
import net.dv8tion.jda.api.entities.Emote;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Message;
|
||||
import org.apache.commons.collections4.Bag;
|
||||
import org.apache.commons.collections4.bag.HashBag;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -52,19 +54,19 @@ public class EmoteTrackingListenerTest {
|
||||
|
||||
@Test
|
||||
public void testExecuteOneEmote() {
|
||||
List<Emote> emotesBag = new ArrayList<>();
|
||||
Bag<Emote> emotesBag = new HashBag<>();
|
||||
emotesBag.add(emote1);
|
||||
when(guildService.getGuildById(SERVER_ID)).thenReturn(guild);
|
||||
when(messageReceivedModel.getMessage()).thenReturn(message);
|
||||
when(messageReceivedModel.getServerId()).thenReturn(SERVER_ID);
|
||||
when(message.getEmotes()).thenReturn(emotesBag);
|
||||
when(message.getEmotesBag()).thenReturn(emotesBag);
|
||||
testUnit.execute(messageReceivedModel);
|
||||
verify(trackedEmoteService, times(1)).addEmoteToRuntimeStorage(emote1, guild, 1L);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExecuteOneEmoteMultipleTimes() {
|
||||
List<Emote> emotesBag = new ArrayList<>();
|
||||
Bag<Emote> emotesBag = new HashBag<>();
|
||||
when(emote1.getIdLong()).thenReturn(EMOTE_ID);
|
||||
when(emote2.getIdLong()).thenReturn(EMOTE_ID);
|
||||
emotesBag.add(emote1);
|
||||
@@ -72,14 +74,14 @@ public class EmoteTrackingListenerTest {
|
||||
when(guildService.getGuildById(SERVER_ID)).thenReturn(guild);
|
||||
when(messageReceivedModel.getServerId()).thenReturn(SERVER_ID);
|
||||
when(messageReceivedModel.getMessage()).thenReturn(message);
|
||||
when(message.getEmotes()).thenReturn(emotesBag);
|
||||
when(message.getEmotesBag()).thenReturn(emotesBag);
|
||||
testUnit.execute(messageReceivedModel);
|
||||
verify(trackedEmoteService, times(1)).addEmoteToRuntimeStorage(any(CachedEmote.class), eq(guild), eq(2L));
|
||||
verify(trackedEmoteService, times(1)).addEmoteToRuntimeStorage(any(Emote.class), eq(guild), eq(2L));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExecuteMultipleEmotes() {
|
||||
List<Emote> emotesBag = new ArrayList<>();
|
||||
Bag<Emote> emotesBag = new HashBag<>();
|
||||
when(emote1.getIdLong()).thenReturn(EMOTE_ID);
|
||||
when(emote2.getIdLong()).thenReturn(EMOTE_ID + 1);
|
||||
emotesBag.add(emote1);
|
||||
@@ -87,7 +89,7 @@ public class EmoteTrackingListenerTest {
|
||||
when(guildService.getGuildById(SERVER_ID)).thenReturn(guild);
|
||||
when(messageReceivedModel.getServerId()).thenReturn(SERVER_ID);
|
||||
when(messageReceivedModel.getMessage()).thenReturn(message);
|
||||
when(message.getEmotes()).thenReturn(emotesBag);
|
||||
when(message.getEmotesBag()).thenReturn(emotesBag);
|
||||
testUnit.execute(messageReceivedModel);
|
||||
verify(trackedEmoteService, times(1)).addEmoteToRuntimeStorage(emote1, guild, 1L);
|
||||
verify(trackedEmoteService, times(1)).addEmoteToRuntimeStorage(emote2, guild, 1L);
|
||||
@@ -95,7 +97,7 @@ public class EmoteTrackingListenerTest {
|
||||
|
||||
@Test
|
||||
public void testExecuteNoEmote() {
|
||||
when(message.getEmotes()).thenReturn(new ArrayList<>());
|
||||
when(message.getEmotesBag()).thenReturn(new HashBag<>());
|
||||
when(messageReceivedModel.getMessage()).thenReturn(message);
|
||||
testUnit.execute(messageReceivedModel);
|
||||
verify(trackedEmoteService, times(0)).addEmoteToRuntimeStorage(any(Emote.class), any(), anyLong());
|
||||
|
||||
@@ -29,12 +29,9 @@ public class UpdateTrackedEmoteListenerTest {
|
||||
|
||||
@Test
|
||||
public void testEmoteUpdated() {
|
||||
Long serverId = 1L;
|
||||
Long emoteId = 2L;
|
||||
Emote changedEmote = Mockito.mock(Emote.class);
|
||||
when(changedEmote.getIdLong()).thenReturn(emoteId);
|
||||
TrackedEmote trackedEmote = Mockito.mock(TrackedEmote.class);
|
||||
when(trackedEmoteManagementService.loadByEmoteId(emoteId, serverId)).thenReturn(trackedEmote);
|
||||
when(trackedEmoteManagementService.loadByEmote(changedEmote)).thenReturn(trackedEmote);
|
||||
String newValue = "AFTER";
|
||||
when(model.getEmote()).thenReturn(changedEmote);
|
||||
when(model.getNewValue()).thenReturn(newValue);
|
||||
|
||||
Reference in New Issue
Block a user