Search in sources :

Example 6 with GenericLoader

use of pcgen.persistence.lst.GenericLoader in project pcgen by PCGen.

the class VisionTokenTest method setUp.

/*
	 * @see TestCase#setUp()
	 */
@Override
protected void setUp() throws Exception {
    super.setUp();
    final GenericLoader<PCTemplate> loader = new GenericLoader<>(PCTemplate.class);
    final LoadContext context = Globals.getContext();
    CampaignSourceEntry source;
    try {
        source = new CampaignSourceEntry(new Campaign(), new URI("file:/" + getClass().getName() + ".java"));
    } catch (URISyntaxException e) {
        throw new UnreachableError(e);
    }
    loader.parseLine(context, null, "Darkvision		VISION:Darkvision (60')", source);
    darkvisionT = context.getReferenceContext().silentlyGetConstructedCDOMObject(PCTemplate.class, "Darkvision");
    loader.parseLine(context, null, "Low-light		VISION:Low-light", source);
    lowlightT = context.getReferenceContext().silentlyGetConstructedCDOMObject(PCTemplate.class, "Low-light");
    loader.parseLine(context, null, "Astral		VISION:Astral (130')", source);
    astralT = context.getReferenceContext().silentlyGetConstructedCDOMObject(PCTemplate.class, "Astral");
    assertTrue(context.getReferenceContext().resolveReferences(null));
    metricUS = new UnitSet();
    metricUS.setName("Metric");
    metricUS.setDistanceUnit("m");
    metricUS.setDistanceFactor(new BigDecimal(0.3));
    metricUS.setDistanceDisplayPattern(new DecimalFormat("#.##"));
    SettingsHandler.getGame().getModeContext().getReferenceContext().importObject(metricUS);
}
Also used : CampaignSourceEntry(pcgen.persistence.lst.CampaignSourceEntry) Campaign(pcgen.core.Campaign) DecimalFormat(java.text.DecimalFormat) GenericLoader(pcgen.persistence.lst.GenericLoader) LoadContext(pcgen.rules.context.LoadContext) UnitSet(pcgen.core.UnitSet) URISyntaxException(java.net.URISyntaxException) UnreachableError(pcgen.base.lang.UnreachableError) PCTemplate(pcgen.core.PCTemplate) URI(java.net.URI) BigDecimal(java.math.BigDecimal)

Aggregations

CampaignSourceEntry (pcgen.persistence.lst.CampaignSourceEntry)6 GenericLoader (pcgen.persistence.lst.GenericLoader)6 LoadContext (pcgen.rules.context.LoadContext)5 URI (java.net.URI)4 URISyntaxException (java.net.URISyntaxException)4 UnreachableError (pcgen.base.lang.UnreachableError)4 PCClassLoader (pcgen.persistence.lst.PCClassLoader)3 BigDecimal (java.math.BigDecimal)1 DecimalFormat (java.text.DecimalFormat)1 OrderedPairManager (pcgen.base.format.OrderedPairManager)1 StringManager (pcgen.base.format.StringManager)1 AssociatedPrereqObject (pcgen.cdom.base.AssociatedPrereqObject)1 CDOMReference (pcgen.cdom.base.CDOMReference)1 CNAbility (pcgen.cdom.content.CNAbility)1 ChallengeRating (pcgen.cdom.content.ChallengeRating)1 AbilityList (pcgen.cdom.list.AbilityList)1 ClassSpellList (pcgen.cdom.list.ClassSpellList)1 Campaign (pcgen.core.Campaign)1 PCTemplate (pcgen.core.PCTemplate)1 UnitSet (pcgen.core.UnitSet)1