fix issue 869

This commit is contained in:
Shang Jihao 2021-04-25 18:09:24 +08:00
parent 0e80f2a4c8
commit d3e58de851
2 changed files with 19 additions and 0 deletions

View File

@ -200,6 +200,11 @@ public final class Ability {
return this; return this;
} }
public AbilityBuilder setStatsEnabled(boolean statsEnabled) {
this.statsEnabled = statsEnabled;
return this;
}
public AbilityBuilder privacy(Privacy privacy) { public AbilityBuilder privacy(Privacy privacy) {
this.privacy = privacy; this.privacy = privacy;
return this; return this;

View File

@ -5,6 +5,8 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.telegram.abilitybots.api.bot.DefaultBot.getDefaultBuilder; import static org.telegram.abilitybots.api.bot.DefaultBot.getDefaultBuilder;
class AbilityTest { class AbilityTest {
@ -55,5 +57,17 @@ class AbilityTest {
assertEquals(ability1, ability4, "Abilities should not be equal"); assertEquals(ability1, ability4, "Abilities should not be equal");
assertNotEquals(ability1, ability3, "Abilities should be equal"); assertNotEquals(ability1, ability3, "Abilities should be equal");
} }
@Test
void abilityBuilderSetStatsEnabledTrueTest() {
Ability statsEnabledAbility = getDefaultBuilder().setStatsEnabled(true).build();
assertTrue(statsEnabledAbility.statsEnabled());
}
@Test
void abilityBuilderSetStatsEnabledFalseTest() {
Ability statsDisabledAbility = getDefaultBuilder().setStatsEnabled(false).build();
assertFalse(statsDisabledAbility.statsEnabled());
}
} }