revert indentation changes

This commit is contained in:
Valentin Afanasiev 2021-01-26 13:39:41 +03:00
parent eea4c3adc1
commit ec4f81b94a
2 changed files with 23 additions and 23 deletions

View File

@ -260,8 +260,8 @@ public abstract class BaseAbilityBot extends DefaultAbsSender implements Ability
public boolean isGroupAdmin(long chatId, int id) { public boolean isGroupAdmin(long chatId, int id) {
GetChatAdministrators admins = GetChatAdministrators.builder().chatId(Long.toString(chatId)).build(); GetChatAdministrators admins = GetChatAdministrators.builder().chatId(Long.toString(chatId)).build();
return silent.execute(admins) return silent.execute(admins)
.orElse(new ArrayList<>()).stream() .orElse(new ArrayList<>()).stream()
.anyMatch(member -> member.getUser().getId() == id); .anyMatch(member -> member.getUser().getId() == id);
} }
public boolean isCreator(int id) { public boolean isCreator(int id) {
@ -326,17 +326,17 @@ public abstract class BaseAbilityBot extends DefaultAbsSender implements Ability
DefaultAbilities defaultAbs = new DefaultAbilities(this); DefaultAbilities defaultAbs = new DefaultAbilities(this);
Stream<Ability> defaultAbsStream = stream(DefaultAbilities.class.getMethods()) Stream<Ability> defaultAbsStream = stream(DefaultAbilities.class.getMethods())
.filter(checkReturnType(Ability.class)) .filter(checkReturnType(Ability.class))
.map(returnAbility(defaultAbs)) .map(returnAbility(defaultAbs))
.filter(ab -> !toggle.isOff(ab)) .filter(ab -> !toggle.isOff(ab))
.map(toggle::processAbility); .map(toggle::processAbility);
// Extract all abilities from every single extension instance // Extract all abilities from every single extension instance
abilities = Stream.concat(defaultAbsStream, abilities = Stream.concat(defaultAbsStream,
extensions.stream() extensions.stream()
.flatMap(ext -> stream(ext.getClass().getMethods()) .flatMap(ext -> stream(ext.getClass().getMethods())
.filter(checkReturnType(Ability.class)) .filter(checkReturnType(Ability.class))
.map(returnAbility(ext)))) .map(returnAbility(ext))))
// Abilities are immutable, build it respectively // Abilities are immutable, build it respectively
.collect(ImmutableMap::<String, Ability>builder, .collect(ImmutableMap::<String, Ability>builder,
(b, a) -> b.put(a.name(), a), (b, a) -> b.put(a.name(), a),

View File

@ -692,19 +692,19 @@ public class AbilityBotTest {
// Gotta filter out hashCode // Gotta filter out hashCode
.filter(method -> method.getReturnType().getName().equals("boolean")) .filter(method -> method.getReturnType().getName().equals("boolean"))
.forEach(method -> { .forEach(method -> {
Update update = mock(Update.class); Update update = mock(Update.class);
try { try {
// Mock the method and make sure it returns true so that it gets processed by the following method // Mock the method and make sure it returns true so that it gets processed by the following method
when(method.invoke(update)).thenReturn(true); when(method.invoke(update)).thenReturn(true);
// Call the function, throws an IllegalStateException if there's an update that can't be processed // Call the function, throws an IllegalStateException if there's an update that can't be processed
utilMethod.accept(update); utilMethod.accept(update);
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
throw new RuntimeException( throw new RuntimeException(
format("Found an update variation that is not handled by the getChatId util method [%s]", method.getName()), e); format("Found an update variation that is not handled by the getChatId util method [%s]", method.getName()), e);
} catch (NullPointerException | ReflectiveOperationException e) { } catch (NullPointerException | ReflectiveOperationException e) {
// This is fine, the mock isn't complete and we're only // This is fine, the mock isn't complete and we're only
// looking for IllegalStateExceptions thrown by the method // looking for IllegalStateExceptions thrown by the method
} }
}); });
} }