Created
November 23, 2009 10:30
-
-
Save masterzen/241001 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.daysofwonder.mm.achievements | |
import MMPlayerImpl; | |
import Side; | |
import Achievement; | |
import AchievementRepository; | |
global AchievementRepository achievementRepository; | |
global java.util.List achievementList; | |
rule "Wet Feet should be awarded to Player on beach" | |
when | |
a : Achievement( id == 12 ) from achievementList | |
p : MMPlayerImpl( side == Side.ALLIES ) | |
then | |
achievementRepository.award(p, a); | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void achWetFeetShouldBeAwardedOnToAlliesPlayerForSwordBeach() throws FileNotFoundException | |
{ | |
MMPlayerImpl axis = new MMPlayerImpl("axis"); | |
axis.setSide(Side.AXIS); | |
MMPlayerImpl allies = new MMPlayerImpl("allies"); | |
allies.setSide(Side.ALLIES); | |
List<Achievement> achievements = new ArrayList<Achievement>(); | |
achievements.add(createAchievement(12, "", "")); | |
when(achievementRepository.getAllAchievements()).thenReturn(achievements); | |
ksession.insert(allies); | |
ksession.insert(axis); | |
ksession.setGlobal( "achievementRepository", achievementRepository ); | |
ksession.setGlobal( "achievementList", achievements ); | |
ksession.fireAllRules(); | |
verify(achievementRepository).award(allies,createAchievement(12, "", "")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment