Clover coverage report - jMock - 1.0-beta1
Coverage timestamp: Sat Nov 29 2003 19:35:59 GMT
file stats: LOC: 49   Methods: 6
NCLOC: 38   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
ExpectationSegment.java 83.3% 100% 100% 96.2%
coverage coverage
 1   
 /* Copyright (c) 2000-2003, jMock.org. See bundled LICENSE.txt */
 2   
 package org.jmock.expectation;
 3   
 
 4   
 
 5   
 
 6   
 public class ExpectationSegment extends AbstractExpectation {
 7   
     private String myExpectedSegment;
 8   
     private String myActualString;
 9   
 
 10  14
     public ExpectationSegment(String name) {
 11  14
         super(name);
 12  14
         clearActual();
 13   
     }
 14   
 
 15  26
     public void clearActual() {
 16  26
         myActualString = null;
 17   
     }
 18   
 
 19  12
     public void setActual(String aString) {
 20  12
         myActualString = aString;
 21  12
         if (shouldCheckImmediately()) {
 22  6
             verify();
 23   
         }
 24   
     }
 25   
 
 26  12
     public void setExpected(String segment) {
 27  12
         myExpectedSegment = segment;
 28  12
         setHasExpectations();
 29   
     }
 30   
 
 31  6
     public void setExpectNothing() {
 32  6
         myActualString = null;
 33  6
         setExpected(null);
 34   
     }
 35   
 
 36  12
     public void verify() {
 37  12
         if (hasExpectations()) {
 38  12
             if (null == myExpectedSegment) {
 39  4
                 AssertMo.assertNull("Expecting nothing", myActualString);
 40   
             } else {
 41  8
                 AssertMo.assertIncludes(
 42   
                         "Should include string segment",
 43   
                         myExpectedSegment,
 44   
                         myActualString);
 45   
             }
 46   
         }
 47   
     }
 48   
 }
 49