Test PREREQs for Desc. @throws PersistenceLayerException the persistence layer exception
()
| 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. |
nothing calls this directly
no test coverage detected