mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-13 04:42:07 -08:00
Reorganized power tests ...
... and changed creation of fake tiles so update() implementations have all required dependencies
This commit is contained in:
parent
a9517096f9
commit
11e071289b
4 changed files with 92 additions and 17 deletions
37
tests/src/test/java/power/ItemLiquidGeneratorTests.java
Normal file
37
tests/src/test/java/power/ItemLiquidGeneratorTests.java
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
package power;
|
||||
|
||||
import io.anuke.mindustry.type.Item;
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.power.ItemLiquidGenerator;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/** This class tests the abstract ItemLiquidGenerator class and maybe some of its dependencies. */
|
||||
public class ItemLiquidGeneratorTests extends PowerTestFixture{
|
||||
|
||||
private ItemLiquidGenerator sut; // system under test (https://en.wikipedia.org/wiki/System_under_test)
|
||||
private Tile tile;
|
||||
|
||||
@BeforeEach
|
||||
public void createItemLiquidGenerator(){
|
||||
sut = new ItemLiquidGenerator("fakegen"){
|
||||
@Override
|
||||
protected float getLiquidEfficiency(Liquid liquid){
|
||||
return liquid.flammability;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getItemEfficiency(Item item){
|
||||
return item.flammability;
|
||||
}
|
||||
};
|
||||
tile = createFakeTile(0, 0, sut);
|
||||
}
|
||||
|
||||
@Test
|
||||
void detectCrashes(){
|
||||
sut.update(tile);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue