Fixed tests that I broke when changing ruleset logic

This commit is contained in:
Yair Morgenstern 2020-01-05 23:00:03 +02:00
parent 285c92150c
commit c322a5da30
2 changed files with 17 additions and 4 deletions

View File

@ -4,13 +4,23 @@ package com.unciv.testing
import com.badlogic.gdx.Gdx
import com.unciv.UncivGame
import com.unciv.models.ruleset.Ruleset
import com.unciv.models.ruleset.RulesetCache
import com.unciv.models.ruleset.unit.BaseUnit
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(GdxTestRunner::class)
class BasicTests {
var ruleset = Ruleset()
@Before
fun loadTranslations() {
RulesetCache.loadRulesets()
ruleset = RulesetCache.getBaseRuleset()
}
@Test
fun gamePngExists() {
Assert.assertTrue("This test will only pass when the game.png exists",
@ -20,7 +30,7 @@ class BasicTests {
@Test
fun loadRuleset() {
Assert.assertTrue("This test will only pass when the jsons can be loaded",
Ruleset(true).buildings.size > 0)
ruleset.buildings.size > 0)
}
@Test
@ -34,7 +44,7 @@ class BasicTests {
// and we try to work on its upgrade, we'll get an exception - see techManager
@Test
fun allObsoletingUnitsHaveUpgrades() {
val units: Collection<BaseUnit> = Ruleset(true).units.values
val units: Collection<BaseUnit> = ruleset.units.values
var allObsoletingUnitsHaveUpgrades = true
for (unit in units) {
if (unit.obsoleteTech != null && unit.upgradesTo == null) {

View File

@ -6,22 +6,25 @@ import com.badlogic.gdx.utils.Array
import com.unciv.JsonParser
import com.unciv.models.ruleset.Nation
import com.unciv.models.ruleset.Ruleset
import com.unciv.models.ruleset.RulesetCache
import com.unciv.models.translations.Translations
import org.junit.Assert
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import java.util.HashSet
import java.util.*
@RunWith(GdxTestRunner::class)
class TranslationTests {
private var translations = Translations()
private var ruleSet = Ruleset(true)
private var ruleSet = Ruleset()
private val jsonParser = JsonParser()
@Before
fun loadTranslations() {
translations.readAllLanguagesTranslation()
RulesetCache.loadRulesets()
ruleSet = RulesetCache.getBaseRuleset()
}
@Test