Clover coverage report - Maven Clover report
Coverage timestamp: Sun Mar 18 2007 17:42:32 CET
file stats: LOC: 58   Methods: 4
NCLOC: 49   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
EngineException.java 75% 81.2% 75% 79.2%
coverage coverage
 1    package com.agical.rmock.core.expectation;
 2   
 3    import com.agical.rmock.core.Section;
 4    import com.agical.rmock.core.describe.impl.DocumentExpectationsVisitor;
 5    import com.agical.rmock.core.exception.RMockSystemException;
 6   
 7    public abstract class EngineException extends RMockSystemException {
 8    private static boolean generatingMessage = false;
 9    private String message;
 10   
 11  0 public EngineException(Section root, boolean isRecording, String message, Throwable cause) {
 12  0 super (cause);
 13  0 this.message = generateMessage( root, isRecording, message );
 14    }
 15   
 16  10 public EngineException(Section root, boolean isRecording, String message) {
 17  10 super ("");
 18  10 this.message = generateMessage( root, isRecording, message );
 19    }
 20   
 21  10 private String generateMessage(Section root, boolean isRecording, String message) {
 22  10 DocumentExpectationsVisitor visitor = new DocumentExpectationsVisitor(" ");
 23  10 String expectationMessage = "Could not generate expectations due to exception!";
 24  10 if (!generatingMessage) {
 25  10 generatingMessage = true;
 26  10 try {
 27  10 root.accept(visitor, true);
 28  10 expectationMessage = visitor.getMessage();
 29    }
 30    catch(EngineException e) {
 31  0 expectationMessage = "!!!!!!!! caught <"+e.getClass()+"> while generating expectations. The following listing is not complete:\n"+
 32    visitor.getMessage() + "\n"+
 33    "\n--------------------------------------------------------------------------"+
 34    "\n The message of the caught exception: " +
 35    "\n--------------------------------------------------------------------------"+
 36    e.getMessage();
 37    }
 38    finally {
 39  10 generatingMessage=false;
 40    }
 41    }
 42   
 43   
 44  10 String stateString = isRecording?"\nStill in setup state! (startVerification has not yet been called)":"";
 45  10 return "\n"+message+
 46    "\n-----------------------------------------------------------------"+
 47    stateString+
 48    "\n"+visitor.getMatchedExpectations().length+" expectation(s) have not yet been matched"+
 49    "\n(indicated by '->' in the listing below)"+
 50    "\n-----------------------------------------------------------------"+
 51    "\n"+expectationMessage;
 52    }
 53   
 54   
 55  4 public String getMessage() {
 56  4 return message;
 57    }
 58    }