Test the passes method. Currently this concentrates on making sure the invert result is working. @throws PersistenceLayerException the persistence layer exception
()
| 27 | * @throws PersistenceLayerException the persistence layer exception |
| 28 | */ |
| 29 | @Test |
| 30 | public void testPasses() throws PersistenceLayerException |
| 31 | { |
| 32 | final PreParserFactory factory = PreParserFactory.getInstance(); |
| 33 | |
| 34 | final Prerequisite prereqNeg = factory.parse("!PREALIGN:LG,LN,LE"); |
| 35 | final Prerequisite prereq = factory.parse("PREALIGN:NG,TN,NE,CG,CN,CE"); |
| 36 | |
| 37 | final PlayerCharacter pc = getCharacter(); |
| 38 | final Race human = new Race(); |
| 39 | human.setName("Human"); |
| 40 | pc.setRace(human); |
| 41 | |
| 42 | AlignmentCompat.setCurrentAlignment(pc.getCharID(), le); |
| 43 | assertFalse("Non-negate returns false", PrereqHandler.passes( |
| 44 | prereq, pc, null)); |
| 45 | assertFalse("Negate returns false", PrereqHandler.passes( |
| 46 | prereqNeg, pc, null)); |
| 47 | |
| 48 | AlignmentCompat.setCurrentAlignment(pc.getCharID(), tn); |
| 49 | assertTrue("Non-negate returns true", PrereqHandler.passes( |
| 50 | prereq, pc, null)); |
| 51 | assertTrue("Negate returns true", PrereqHandler.passes( |
| 52 | prereqNeg, pc, null)); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Tests PREFEAT. |
nothing calls this directly
no test coverage detected