Reorganized power tests ...

... and changed creation of fake tiles so update() implementations have all required dependencies
This commit is contained in:
Timmeey86 2018-11-27 08:51:19 +01:00
parent a9517096f9
commit 11e071289b
4 changed files with 92 additions and 17 deletions

View 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);
}
}