01 /*
02 * Created on Aug 29, 2007
03 *
04 */
05 package com.x8ing.mc.bp.develop;
06
07 import java.util.List;
08
09 import com.x8ing.lsm4j.Condition;
10 import com.x8ing.lsm4j.StateContext;
11 import com.x8ing.mc.bp.Bug;
12 import com.x8ing.mc.bp.BusinessContext;
13
14 /**
15 * Returns true if the getBugsToBeFixed list is empty.
16 *
17 * @author Patrick Heusser
18 */
19 public class TestingPassedCondition implements Condition {
20
21 private boolean inverse = false;
22
23 public TestingPassedCondition(boolean inverse) {
24 this.inverse = inverse;
25 }
26
27 /**
28 * @see com.x8ing.lsm4j.Condition#traceInfo()
29 */
30 public String traceInfo() {
31
32 return "";
33 }
34
35 /**
36 * @see com.x8ing.lsm4j.Condition#conditionTrue(com.x8ing.lsm4j.StateContext)
37 */
38 public boolean conditionTrue(StateContext currentContext) {
39
40 BusinessContext businessContext = (BusinessContext) currentContext;
41
42 List testingFailedBugs = businessContext.getBugs().getBugsWithState(Bug.BugState.STATE_BUG_TEST_FAILED);
43
44 boolean testingSuccessful = testingFailedBugs.isEmpty();
45
46 return inverse ? !testingSuccessful : testingSuccessful;
47
48 }
49 }
|