Search in sources :

Example 16 with MigrationRule

use of pcgen.core.system.MigrationRule in project pcgen by PCGen.

the class MigrationLoaderTest method testParseFirstTokenValidCharsInSourceKey.

@Test
public void testParseFirstTokenValidCharsInSourceKey() {
    String sourceKey = "Paizo - Second Darkness, Chapter 6: Descent into Midnight.";
    MigrationRule migrationRule = migrationLoader.parseFirstToken("SOURCE:" + sourceKey, "", sourceURI);
    assertNotNull("Key should have been accepted.", migrationRule);
    assertEquals("Source key should have been recorded", sourceKey, migrationRule.getOldKey());
}
Also used : MigrationRule(pcgen.core.system.MigrationRule) Test(org.junit.Test)

Example 17 with MigrationRule

use of pcgen.core.system.MigrationRule in project pcgen by PCGen.

the class MinDevVerTokenTest method setUp.

/**
	 * @throws java.lang.Exception
	 */
@Before
public void setUp() throws Exception {
    migrationRule = new MigrationRule(ObjectType.SOURCE, "OldKey");
    token = new MinDevVerToken();
    gameModeName = "Pathfinder";
}
Also used : MigrationRule(pcgen.core.system.MigrationRule) Before(org.junit.Before)

Example 18 with MigrationRule

use of pcgen.core.system.MigrationRule in project pcgen by PCGen.

the class NewCategoryTokenTest method setUp.

/**
	 * @throws java.lang.Exception
	 */
@Before
public void setUp() throws Exception {
    migrationRule = new MigrationRule(ObjectType.SOURCE, "OldKey");
    token = new NewCategoryToken();
    gameModeName = "Pathfinder";
}
Also used : MigrationRule(pcgen.core.system.MigrationRule) Before(org.junit.Before)

Example 19 with MigrationRule

use of pcgen.core.system.MigrationRule in project pcgen by PCGen.

the class MigrationLoaderTest method testParseFirstTokenInValidCharsInAbilityCategory.

/**
	 * Check that these invalid characters are rejected in a category ,\\|\\:;.%*=[]
	 */
@Test
public void testParseFirstTokenInValidCharsInAbilityCategory() {
    String invalidChars = ",|\\:;%*=[]";
    for (char invalid : invalidChars.toCharArray()) {
        MigrationRule migrationRule = migrationLoader.parseFirstToken("ABILITY:Old" + invalid + "|Key", "", sourceURI);
        assertNull("Key containing " + invalid + " should have been rejected.", migrationRule);
    }
}
Also used : MigrationRule(pcgen.core.system.MigrationRule) Test(org.junit.Test)

Example 20 with MigrationRule

use of pcgen.core.system.MigrationRule in project pcgen by PCGen.

the class MigrationLoaderTest method testParseAbilityLine.

@Test
public void testParseAbilityLine() throws Exception {
    String abilityMigration = "ABILITY:Special Ability|Animal Fury	NEWKEY:Animal Fury ~ Rage Power	" + "MAXVER:6.00.00	MAXDEVVER:6.01.01";
    migrationLoader.parseLine(null, abilityMigration, new URI("http://UNIT_TEST_CASE"));
    boolean found = false;
    List<MigrationRule> migrationRuleList = SystemCollections.getUnmodifiableMigrationRuleList(SettingsHandler.getGame().getName());
    for (MigrationRule migrationRule : migrationRuleList) {
        if (migrationRule.getObjectType() == ObjectType.ABILITY && migrationRule.getOldCategory().equals("Special Ability") && migrationRule.getOldKey().equals("Animal Fury")) {
            assertNull("new category", migrationRule.getNewCategory());
            assertEquals("new key", "Animal Fury ~ Rage Power", migrationRule.getNewKey());
            assertEquals("max ver", "6.00.00", migrationRule.getMaxVer());
            assertEquals("max dev ver", "6.01.01", migrationRule.getMaxDevVer());
            found = true;
        }
    }
    assertTrue("Unable to find migration rule", found);
}
Also used : MigrationRule(pcgen.core.system.MigrationRule) URI(java.net.URI) Test(org.junit.Test)

Aggregations

MigrationRule (pcgen.core.system.MigrationRule)25 Test (org.junit.Test)12 Before (org.junit.Before)6 URI (java.net.URI)3 ArrayList (java.util.ArrayList)1 StringTokenizer (java.util.StringTokenizer)1 UnreachableError (pcgen.base.lang.UnreachableError)1 ObjectType (pcgen.core.system.MigrationRule.ObjectType)1