Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 package org.hansel.probes; 2 3 import org.hansel.Probe; 4 import org.hansel.ProbeData; 5 import org.hansel.stack.HanselValue; 6 7 8 14 public abstract class BranchProbe extends Probe { 15 16 private boolean coverTrue; 17 18 19 private boolean coverFalse; 20 21 private HanselValue value; 22 23 public BranchProbe(ProbeData pd, 24 HanselValue value) { 25 super(pd); 26 27 this.value = value; 28 this.coverTrue = false; 29 this.coverFalse = false; 30 } 31 32 33 37 public String getFailureMessage() { 38 String expression; 39 if (coverTrue) { 40 expression = value.invert().toString(); 41 } else { 42 expression = value.toString(); 43 } 44 45 String result = "Branch not completely covered. Condition '" 46 + expression 47 + "' is not fulfilled."; 48 49 return result; 50 } 51 52 protected void cover(boolean condition) { 53 if (condition) { 54 coverTrue = true; 55 } else { 56 coverFalse = true; 57 } 58 } 59 60 70 public boolean displayFailure() { 71 return coverTrue ^ coverFalse; 72 } 73 74 public boolean coverageFailure() { 75 return !(coverTrue & coverFalse); 76 } 77 78 } 79
| Popular Tags
|