[AB-136] replacing some rare occurrences where fake objects where used for actual database operations

replacing a few sync commands with async commands
refactoring parameters in assignable role place service bean
fixing emote parameter handler to also consider default emojis
removing unused description in command
replacing some ARole parameters with Role parameters, so we can be sure they exists
added a few TODOs marking exception changes required
This commit is contained in:
Sheldan
2020-10-03 15:24:52 +02:00
parent 0f6f6a1e49
commit a391381ff6
37 changed files with 230 additions and 115 deletions

View File

@@ -56,5 +56,14 @@ public class AEmoteParameterHandlerTest {
Assert.assertEquals(aEmote, parsed);
}
@Test
public void testDefaultEmoteHandling() {
String input = "test";
when(emoteParameterHandler.handle(input, iterators, Emote.class, message)).thenReturn(null);
when(emoteService.getFakeEmote(input)).thenReturn(aEmote);
AEmote parsed = (AEmote) testUnit.handle(input, iterators, AEmote.class, message);
Assert.assertEquals(aEmote, parsed);
}
}

View File

@@ -62,10 +62,9 @@ public class EmoteParameterHandlerTest {
Assert.assertEquals(parsed, emote);
}
@Test(expected = NumberFormatException.class)
@Test
public void testInvalidEmoteMention() {
String input = "test";
testUnit.handle(input, null, Emote.class, null);
Assert.assertNull(testUnit.handle("test", null, Emote.class, null));
}
private String getEmoteMention() {

View File

@@ -59,4 +59,15 @@ public class FullEmoteParameterHandlerTest {
}
@Test
public void testDefaultEmoteHandling() {
String input = "test";
when(emoteParameterHandler.handle(input, iterators, Emote.class, message)).thenReturn(null);
when(emoteService.getFakeEmote(input)).thenReturn(aEmote);
FullEmote parsed = (FullEmote) testUnit.handle(input, iterators, AEmote.class, message);
Assert.assertNull(parsed.getEmote());
Assert.assertEquals(aEmote, parsed.getFakeEmote());
}
}