Refactored card cache;

This commit is contained in:
magenoxx 2012-06-26 16:17:25 +04:00
parent 96daa4e0a9
commit 5fa99262bf
4 changed files with 132 additions and 123 deletions

View file

@ -14,10 +14,13 @@ import java.util.Set;
*/
public class CacheTest {
/**
* In case this test fails, it does mean that you need to update cache version in Sets.java
*/
@Test
public void testCacheConsistency() {
//Set<String> names = Sets.getCardNames();
//Set<String> nonLandNames = Sets.getNonLandCardNames();
Set<String> names = Sets.getCardNames();
Set<String> nonLandNames = Sets.getNonLandCardNames();
Set<String> creatureTypes = Sets.getCreatureTypes();
for (ExpansionSet set : Sets.getInstance().values()) {
@ -29,6 +32,14 @@ public class CacheTest {
}
}
}
if (!names.contains(card.getName())) {
Assert.assertTrue("Couldn't find a card name in the cache: " + card.getName(), false);
}
if (!card.getCardType().contains(Constants.CardType.LAND)) {
if (!nonLandNames.contains(card.getName())) {
Assert.assertTrue("Couldn't find a non-land card name in the cache: " + card.getName(), false);
}
}
}
}
}