-
-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Starter Commit * Removed Test * Requested Change * Requested Changes * Requested Changes * Requested Changes Plus Test * Add private --------- Co-authored-by: Efnilite <[email protected]> Co-authored-by: sovdee <[email protected]>
- Loading branch information
1 parent
6f0b993
commit a22e34e
Showing
3 changed files
with
116 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
.../java/org/skriptlang/skript/test/tests/syntaxes/expressions/ExprAffectedEntitiesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.skriptlang.skript.test.tests.syntaxes.expressions; | ||
|
||
import ch.njol.skript.test.runner.SkriptJUnitTest; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.entity.AreaEffectCloud; | ||
import org.bukkit.entity.EntityType; | ||
import org.bukkit.entity.LivingEntity; | ||
import org.bukkit.entity.Pig; | ||
import org.bukkit.event.entity.AreaEffectCloudApplyEvent; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ExprAffectedEntitiesTest extends SkriptJUnitTest { | ||
|
||
private AreaEffectCloud cloud; | ||
private Pig piggy; | ||
private final List<LivingEntity> entityList = new ArrayList<>(); | ||
|
||
@Before | ||
public void setUp() { | ||
piggy = spawnTestPig(); | ||
entityList.add(piggy); | ||
cloud = (AreaEffectCloud) getTestWorld().spawnEntity(getTestLocation(), EntityType.AREA_EFFECT_CLOUD); | ||
} | ||
|
||
@Test | ||
public void callEvent() { | ||
AreaEffectCloudApplyEvent event = new AreaEffectCloudApplyEvent(cloud, entityList); | ||
Bukkit.getPluginManager().callEvent(event); | ||
} | ||
|
||
@After | ||
public void cleanUp() { | ||
if (piggy != null) | ||
piggy.remove(); | ||
if (cloud != null) | ||
cloud.remove(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
on load: | ||
set {_tests::1} to "cleared piggies" | ||
set {_tests::2} to "add 5 pigs" | ||
set {_tests::3} to "remove 2 pigs" | ||
set {_tests::4} to "set 4 pigs" | ||
|
||
ensure junit test "org.skriptlang.skript.test.tests.syntaxes.expressions.ExprAffectedEntitiesTest" completes {_tests::*} | ||
|
||
on area effect: | ||
set {_test} to "org.skriptlang.skript.test.tests.syntaxes.expressions.ExprAffectedEntitiesTest" | ||
junit test is {_test} | ||
clear affected entities | ||
spawn 5 pigs at spawn of world "world": | ||
add entity to {_pigs::*} | ||
add {_pigs::*} to affected entities | ||
if size of affected entities = 5: | ||
complete objective "add 5 pigs" for junit test {_test} | ||
remove (elements from 1 to 2 of {_pigs::*}) from affected entities | ||
if size of affected entities = 3: | ||
complete objective "remove 2 pigs" for junit test {_test} | ||
set affected entities to (elements from 1 to 4 of {_pigs::*}) | ||
if size of affected entities = 4: | ||
complete objective "set 4 pigs" for junit test {_test} | ||
clear affected entities | ||
if size of affected entities = 0: | ||
complete objective "cleared piggies" for junit test {_test} | ||
clear entities within {_pigs::*} |