Updated ExtensionTest and wiki
This commit is contained in:
parent
247ca5f984
commit
3f07bfdff1
@ -38,3 +38,17 @@ public class MrBadGuy implements AbilityExtension {
|
||||
// Override creatorId
|
||||
}
|
||||
```
|
||||
|
||||
It's also possible to add extensions in the constructor by using the `addExtension()` or `addExtensions()` method:
|
||||
|
||||
```java
|
||||
public class YourAwesomeBot implements AbilityBot {
|
||||
|
||||
public YourAwesomeBot() {
|
||||
super(/* pass required args ... */);
|
||||
addExtensions(new MrGoodGuy(), new MrBadGuy());
|
||||
}
|
||||
|
||||
// Override creatorId
|
||||
}
|
||||
```
|
@ -32,6 +32,7 @@ class ExtensionTest {
|
||||
assertTrue(hasAbilityNamed("direct"), "Failed to find Ability in directly declared in root extension/bot");
|
||||
assertTrue(hasAbilityNamed("returningSuperClass0abc"), "Failed to find Ability in directly declared in extension returned by method returning the AbilityExtension class");
|
||||
assertTrue(hasAbilityNamed("returningSubClass0abc"), "Failed to find Ability in directly declared in extension returned by method returning the AbilityExtension subclass");
|
||||
assertTrue(hasAbilityNamed("addedInConstructor0abc"), "Failed to find Ability in directly declared in extension added in the constructor");
|
||||
}
|
||||
|
||||
private boolean hasAbilityNamed(String name) {
|
||||
@ -41,6 +42,7 @@ class ExtensionTest {
|
||||
public static class ExtensionUsingBot extends AbilityBot {
|
||||
ExtensionUsingBot() {
|
||||
super("", "", offlineInstance("testing"));
|
||||
addExtension(new AbilityBotExtension("addedInConstructor"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user