Verify the getPrereqAbilities method is functioning correctly. @throws PersistenceLayerException the persistence layer exception
()
| 110 | * @throws PersistenceLayerException the persistence layer exception |
| 111 | */ |
| 112 | @Test |
| 113 | public void testGetPrereqAbilities() throws PersistenceLayerException |
| 114 | { |
| 115 | Ability acrobatics = TestHelper.makeAbility("Acrobatics", BuildUtilities.getFeatCat(), "general"); |
| 116 | Ability dodge = TestHelper.makeAbility("Dodge", BuildUtilities.getFeatCat(), "general"); |
| 117 | Ability mobility = TestHelper.makeAbility("Mobility", BuildUtilities.getFeatCat(), "general"); |
| 118 | Ability springAttack = TestHelper.makeAbility("Spring Attack", BuildUtilities.getFeatCat(), "general"); |
| 119 | PreAbilityParser parser = new PreAbilityParser(); |
| 120 | Prerequisite prereq = |
| 121 | parser.parse("ability", "1,CATEGORY=FEAT,KEY_Dodge", |
| 122 | false, false); |
| 123 | mobility.addPrerequisite(prereq); |
| 124 | prereq = |
| 125 | parser.parse("ability", "2,CATEGORY=FEAT,KEY_Dodge,KEY_Mobility", |
| 126 | false, false); |
| 127 | springAttack.addPrerequisite(prereq); |
| 128 | |
| 129 | DataSet dataset = |
| 130 | new DataSet(Globals.getContext(), SettingsHandler.getGameAsProperty().get(), |
| 131 | new DefaultListFacade<>()); |
| 132 | List<AbilityFacade> abilities = dataset.getPrereqAbilities(acrobatics); |
| 133 | assertEquals(0, abilities.size(), "Acrobatics prereq should be empty"); |
| 134 | abilities = dataset.getPrereqAbilities(dodge); |
| 135 | assertEquals(0, abilities.size(), "Dodge prereq should be empty"); |
| 136 | abilities = dataset.getPrereqAbilities(mobility); |
| 137 | assertEquals(1, abilities.size(), "Mobility prereq should not be empty"); |
| 138 | assertEquals(dodge, abilities.get(0), "Mobility prereq should be dodge"); |
| 139 | abilities = dataset.getPrereqAbilities(springAttack); |
| 140 | assertEquals(2, abilities.size(), "Spring Attack prereq should not be empty"); |
| 141 | assertEquals(dodge, abilities.get(0), "Spring Attack prereq should be dodge"); |
| 142 | assertEquals(mobility, abilities.get(1), "Spring Attack prereq should be mobility"); |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * @param locations |
nothing calls this directly
no test coverage detected