diff --git a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java index 726e0789..aa2d8605 100644 --- a/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java +++ b/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java @@ -260,8 +260,8 @@ public abstract class BaseAbilityBot extends DefaultAbsSender implements Ability public boolean isGroupAdmin(long chatId, int id) { GetChatAdministrators admins = GetChatAdministrators.builder().chatId(Long.toString(chatId)).build(); return silent.execute(admins) - .orElse(new ArrayList<>()).stream() - .anyMatch(member -> member.getUser().getId() == id); + .orElse(new ArrayList<>()).stream() + .anyMatch(member -> member.getUser().getId() == id); } public boolean isCreator(int id) { @@ -326,17 +326,17 @@ public abstract class BaseAbilityBot extends DefaultAbsSender implements Ability DefaultAbilities defaultAbs = new DefaultAbilities(this); Stream defaultAbsStream = stream(DefaultAbilities.class.getMethods()) - .filter(checkReturnType(Ability.class)) - .map(returnAbility(defaultAbs)) - .filter(ab -> !toggle.isOff(ab)) - .map(toggle::processAbility); + .filter(checkReturnType(Ability.class)) + .map(returnAbility(defaultAbs)) + .filter(ab -> !toggle.isOff(ab)) + .map(toggle::processAbility); // Extract all abilities from every single extension instance abilities = Stream.concat(defaultAbsStream, - extensions.stream() - .flatMap(ext -> stream(ext.getClass().getMethods()) - .filter(checkReturnType(Ability.class)) - .map(returnAbility(ext)))) + extensions.stream() + .flatMap(ext -> stream(ext.getClass().getMethods()) + .filter(checkReturnType(Ability.class)) + .map(returnAbility(ext)))) // Abilities are immutable, build it respectively .collect(ImmutableMap::builder, (b, a) -> b.put(a.name(), a), diff --git a/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/bot/AbilityBotTest.java b/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/bot/AbilityBotTest.java index 42e87d56..36684043 100644 --- a/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/bot/AbilityBotTest.java +++ b/telegrambots-abilities/src/test/java/org/telegram/abilitybots/api/bot/AbilityBotTest.java @@ -692,19 +692,19 @@ public class AbilityBotTest { // Gotta filter out hashCode .filter(method -> method.getReturnType().getName().equals("boolean")) .forEach(method -> { - Update update = mock(Update.class); - try { - // Mock the method and make sure it returns true so that it gets processed by the following method - when(method.invoke(update)).thenReturn(true); - // Call the function, throws an IllegalStateException if there's an update that can't be processed - utilMethod.accept(update); - } catch (IllegalStateException e) { - throw new RuntimeException( - format("Found an update variation that is not handled by the getChatId util method [%s]", method.getName()), e); - } catch (NullPointerException | ReflectiveOperationException e) { - // This is fine, the mock isn't complete and we're only - // looking for IllegalStateExceptions thrown by the method - } + Update update = mock(Update.class); + try { + // Mock the method and make sure it returns true so that it gets processed by the following method + when(method.invoke(update)).thenReturn(true); + // Call the function, throws an IllegalStateException if there's an update that can't be processed + utilMethod.accept(update); + } catch (IllegalStateException e) { + throw new RuntimeException( + format("Found an update variation that is not handled by the getChatId util method [%s]", method.getName()), e); + } catch (NullPointerException | ReflectiveOperationException e) { + // This is fine, the mock isn't complete and we're only + // looking for IllegalStateExceptions thrown by the method + } }); }