mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-01-28 08:38:52 +00:00
[AB-165] removing mocking utils and general test improvements
This commit is contained in:
@@ -59,7 +59,7 @@ public class TrackedEmoteParameterHandlerTest {
|
||||
public void testHandleWithEmote() {
|
||||
when(contextMessage.getGuild()).thenReturn(guild);
|
||||
Emote emote = Mockito.mock(Emote.class);
|
||||
UnparsedCommandParameterPiece input = UnparsedCommandParameterPiece.builder().value(WRONG_FORMATTED_INPUT).build();
|
||||
UnparsedCommandParameterPiece input = Mockito.mock(UnparsedCommandParameterPiece.class);
|
||||
when(emoteParameterHandler.handle(input, iterators, Emote.class, contextMessage)).thenReturn(emote);
|
||||
when(trackedEmoteService.getFakeTrackedEmote(emote, guild)).thenReturn(trackedEmote);
|
||||
TrackedEmote parsedEmote = (TrackedEmote) testUnit.handle(input, iterators, TrackedEmote.class, contextMessage);
|
||||
@@ -70,7 +70,8 @@ public class TrackedEmoteParameterHandlerTest {
|
||||
public void testHandleWithId() {
|
||||
Long emoteId = 5L;
|
||||
when(contextMessage.getGuild()).thenReturn(guild);
|
||||
UnparsedCommandParameterPiece input = UnparsedCommandParameterPiece.builder().value(emoteId.toString()).build();
|
||||
UnparsedCommandParameterPiece input = Mockito.mock(UnparsedCommandParameterPiece.class);
|
||||
when(input.getValue()).thenReturn(emoteId.toString());
|
||||
when(trackedEmoteService.getFakeTrackedEmote(emoteId, guild)).thenReturn(trackedEmote);
|
||||
when(emoteParameterHandler.handle(input, iterators, Emote.class, contextMessage)).thenReturn(null);
|
||||
TrackedEmote parsedEmote = (TrackedEmote) testUnit.handle(input, iterators, TrackedEmote.class, contextMessage);
|
||||
@@ -80,7 +81,8 @@ public class TrackedEmoteParameterHandlerTest {
|
||||
|
||||
@Test(expected = NumberFormatException.class)
|
||||
public void testWithIllegalInput() {
|
||||
UnparsedCommandParameterPiece input = UnparsedCommandParameterPiece.builder().value(WRONG_FORMATTED_INPUT).build();
|
||||
UnparsedCommandParameterPiece input = Mockito.mock(UnparsedCommandParameterPiece.class);
|
||||
when(input.getValue()).thenReturn(WRONG_FORMATTED_INPUT);
|
||||
when(emoteParameterHandler.handle(input, iterators, Emote.class, contextMessage)).thenReturn(null);
|
||||
testUnit.handle(input, iterators, TrackedEmote.class, contextMessage);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class TrackedEmoteParameterParameterHandlerTest {
|
||||
public void testHandleWithEmote() {
|
||||
when(contextMessage.getGuild()).thenReturn(guild);
|
||||
Emote emote = Mockito.mock(Emote.class);
|
||||
UnparsedCommandParameterPiece input = UnparsedCommandParameterPiece.builder().value(WRONG_FORMATTED_INPUT).build();
|
||||
UnparsedCommandParameterPiece input = Mockito.mock(UnparsedCommandParameterPiece.class);
|
||||
when(emoteParameterHandler.handle(input, iterators, Emote.class, contextMessage)).thenReturn(emote);
|
||||
when(trackedEmoteService.getFakeTrackedEmote(emote, guild)).thenReturn(trackedEmote);
|
||||
TrackEmoteParameter parsedEmote = (TrackEmoteParameter) testUnit.handle(input, iterators, TrackedEmote.class, contextMessage);
|
||||
@@ -74,7 +74,8 @@ public class TrackedEmoteParameterParameterHandlerTest {
|
||||
public void testHandleWithId() {
|
||||
Long emoteId = 5L;
|
||||
when(contextMessage.getGuild()).thenReturn(guild);
|
||||
UnparsedCommandParameterPiece input = UnparsedCommandParameterPiece.builder().value(emoteId.toString()).build();
|
||||
UnparsedCommandParameterPiece input = Mockito.mock(UnparsedCommandParameterPiece.class);
|
||||
when(input.getValue()).thenReturn(emoteId.toString());
|
||||
when(trackedEmoteService.getFakeTrackedEmote(emoteId, guild)).thenReturn(trackedEmote);
|
||||
when(emoteParameterHandler.handle(input, iterators, Emote.class, contextMessage)).thenReturn(null);
|
||||
TrackEmoteParameter parsedEmote = (TrackEmoteParameter) testUnit.handle(input, iterators, TrackedEmote.class, contextMessage);
|
||||
@@ -84,7 +85,8 @@ public class TrackedEmoteParameterParameterHandlerTest {
|
||||
|
||||
@Test(expected = NumberFormatException.class)
|
||||
public void testWithIllegalInput() {
|
||||
UnparsedCommandParameterPiece input = UnparsedCommandParameterPiece.builder().value(WRONG_FORMATTED_INPUT).build();
|
||||
UnparsedCommandParameterPiece input = Mockito.mock(UnparsedCommandParameterPiece.class);
|
||||
when(input.getValue()).thenReturn(WRONG_FORMATTED_INPUT);
|
||||
when(emoteParameterHandler.handle(input, iterators, Emote.class, contextMessage)).thenReturn(null);
|
||||
testUnit.handle(input, iterators, TrackedEmote.class, contextMessage);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user