MCPcopy Create free account
hub / github.com/PCGen/pcgen / testPreReqs

Method testPreReqs

code/src/test/pcgen/core/DescriptionTest.java:90–112  ·  view source on GitHub ↗

Test PREREQs for Desc. @throws PersistenceLayerException the persistence layer exception

()

Source from the content-addressed store, hash-verified

88 * @throws PersistenceLayerException the persistence layer exception
89 */
90 @Test
91 public void testPreReqs() throws PersistenceLayerException
92 {
93 final Ability dummy =
94 TestHelper.makeAbility("dummy", BuildUtilities.getFeatCat(), "Foo");
95 final String simpleDesc = "This is a test";
96 final Description desc = new Description(simpleDesc);
97
98 final PreParserFactory factory = PreParserFactory.getInstance();
99
100 final Prerequisite prereqNE = factory.parse("PRETEMPLATE:1,KEY_Natural Lycanthrope");
101 desc.addPrerequisite(prereqNE);
102 List<CNAbility> singletonAbility = Collections.singletonList(CNAbilityFactory
103 .getCNAbility(BuildUtilities.getFeatCat(), Nature.NORMAL, dummy));
104 assertThat(desc.getDescription(getCharacter(), singletonAbility), Matchers.is(""));
105
106 PCTemplate template = new PCTemplate();
107 template.setName("Natural Lycanthrope");
108 template.put(StringKey.KEY_NAME, "KEY_Natural Lycanthrope");
109 Globals.getContext().getReferenceContext().importObject(template);
110 getCharacter().addTemplate(template);
111 assertThat(desc.getDescription(getCharacter(), singletonAbility), Matchers.is(simpleDesc));
112 }
113
114 /**
115 * Tests a simple string replacement.

Callers

nothing calls this directly

Calls 14

makeAbilityMethod · 0.95
getFeatCatMethod · 0.95
getInstanceMethod · 0.95
parseMethod · 0.95
getCNAbilityMethod · 0.95
getDescriptionMethod · 0.95
getContextMethod · 0.95
importObjectMethod · 0.80
addPrerequisiteMethod · 0.65
setNameMethod · 0.65
putMethod · 0.65
getReferenceContextMethod · 0.65

Tested by

no test coverage detected