Search in sources :

Example 6 with ExportHandler

use of pcgen.io.ExportHandler in project pcgen by PCGen.

the class AbilityTokenTest method testHasAspect.

/**
	 * Tests the HASASPECT subtoken of ABILITY.
	 */
public void testHasAspect() {
    AbilityToken tok = new AbilityToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    assertEquals("N", tok.getToken("ABILITY.FEAT.0.HASASPECT.3", character, eh));
    assertEquals("N", tok.getToken("ABILITY.FEAT.0.HASASPECT.5", character, eh));
    assertEquals("N", tok.getToken("ABILITY.FEAT.0.HASASPECT.Attack Type", character, eh));
    assertEquals("Y", tok.getToken("ABILITY.FEAT.0.HASASPECT.Colour", character, eh));
    assertEquals("Y", tok.getToken("ABILITY.FEAT.0.HASASPECT.Age In Years", character, eh));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Example 7 with ExportHandler

use of pcgen.io.ExportHandler in project pcgen by PCGen.

the class AbilityTokenTest method testAspectCount.

/**
	 * Tests the ASPECTCOUNT subtoken of ABILITY.
	 */
public void testAspectCount() {
    AbilityToken tok = new AbilityToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    assertEquals("5", tok.getToken("ABILITY.FEAT.0.ASPECTCOUNT", character, eh));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Example 8 with ExportHandler

use of pcgen.io.ExportHandler in project pcgen by PCGen.

the class AbilityTokenTest method testName.

/**
	 * Tests the name subtoken of ABILITY.
	 */
public void testName() {
    AbilityToken tok = new AbilityToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    assertEquals("Perform (Dance)", tok.getToken("ABILITY.FEAT.0.NAME", character, eh));
    assertEquals("Skill Focus", tok.getToken("ABILITY.FEAT.1.NAME", character, eh));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Example 9 with ExportHandler

use of pcgen.io.ExportHandler in project pcgen by PCGen.

the class VAbilityTokenTest method testNonExistantSingleAspect.

/**
	 * Tests the ASPECT subtoken of VABILITY with an invalid aspect specified.
	 */
public void testNonExistantSingleAspect() {
    VAbilityToken tok = new VAbilityToken();
    ExportHandler eh = new ExportHandler(null);
    PlayerCharacter character = getCharacter();
    assertEquals("", tok.getToken("VABILITY.FEAT.0.ASPECT.-5", character, eh));
    assertEquals("", tok.getToken("VABILITY.FEAT.0.ASPECT.5", character, eh));
    assertEquals("", tok.getToken("VABILITY.FEAT.0.ASPECT.500", character, eh));
    assertEquals("", tok.getToken("VABILITY.FEAT.0.ASPECT.Attack Type", character, eh));
    assertEquals("", tok.getToken("VABILITY.FEAT.0.ASPECT.Target", character, eh));
}
Also used : PlayerCharacter(pcgen.core.PlayerCharacter) ExportHandler(pcgen.io.ExportHandler)

Example 10 with ExportHandler

use of pcgen.io.ExportHandler in project pcgen by PCGen.

the class CampaignHistoryTokenTest method evaluateToken.

private String evaluateToken(String token, PlayerCharacter pc) throws IOException {
    StringWriter retWriter = new StringWriter();
    BufferedWriter bufWriter = new BufferedWriter(retWriter);
    ExportHandler export = new ExportHandler(new File(""));
    export.replaceTokenSkipMath(pc, token, bufWriter);
    retWriter.flush();
    bufWriter.flush();
    return retWriter.toString();
}
Also used : StringWriter(java.io.StringWriter) ExportHandler(pcgen.io.ExportHandler) File(java.io.File) BufferedWriter(java.io.BufferedWriter)

Aggregations

ExportHandler (pcgen.io.ExportHandler)31 PlayerCharacter (pcgen.core.PlayerCharacter)24 File (java.io.File)7 BufferedWriter (java.io.BufferedWriter)6 StringWriter (java.io.StringWriter)4 IOException (java.io.IOException)3 TextToken (plugin.exporttokens.TextToken)3 OutputStreamWriter (java.io.OutputStreamWriter)2 Test (org.junit.Test)2 FileOutputStream (java.io.FileOutputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 CharacterFacade (pcgen.facade.core.CharacterFacade)1 ExportException (pcgen.io.ExportException)1 PCGFile (pcgen.io.PCGFile)1