Search in sources :

Example 6 with MigrationRule

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

the class NewKeyTokenTest method setUp.

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

Example 7 with MigrationRule

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

the class MigrationLoaderTest method testParseFirstTokenValidAbility.

@Test
public void testParseFirstTokenValidAbility() {
    MigrationRule migrationRule = migrationLoader.parseFirstToken("ABILITY:OldCat|Old Key", "", sourceURI);
    assertNotNull("Should have been able to parse valid ability", migrationRule);
    assertEquals("Object type", ObjectType.ABILITY, migrationRule.getObjectType());
    assertEquals("Old key", "Old Key", migrationRule.getOldKey());
    assertEquals("Old category", "OldCat", migrationRule.getOldCategory());
}
Also used : MigrationRule(pcgen.core.system.MigrationRule) Test(org.junit.Test)

Example 8 with MigrationRule

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

the class MigrationLoaderTest method testParseFirstTokenInValidObjType.

@Test
public void testParseFirstTokenInValidObjType() {
    MigrationRule migrationRule = migrationLoader.parseFirstToken("FOO:Old Key", "", sourceURI);
    assertNull(migrationRule);
}
Also used : MigrationRule(pcgen.core.system.MigrationRule) Test(org.junit.Test)

Example 9 with MigrationRule

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

the class MigrationLoaderTest method testParseFirstTokenInValidCharsInAbilityKey.

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

Example 10 with MigrationRule

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

the class MigrationLoaderTest method testParseFirstTokenValidEquipment.

@Test
public void testParseFirstTokenValidEquipment() {
    MigrationRule migrationRule = migrationLoader.parseFirstToken("EQUIPMENT:Old Key", "", sourceURI);
    assertNotNull(migrationRule);
    assertEquals("Object type", ObjectType.EQUIPMENT, migrationRule.getObjectType());
    assertEquals("Old key", "Old Key", migrationRule.getOldKey());
    assertNull("Old category", migrationRule.getOldCategory());
}
Also used : MigrationRule(pcgen.core.system.MigrationRule) 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