[Mockobject-checkins] mockobject2/input/javasrc/biz/xsoftware/mock MockSuperclass.java,1.8,1.9
Brought to you by:
fastdragon
From: Dean H. <dea...@us...> - 2004-12-18 17:49:26
|
Update of /cvsroot/mockobject/mockobject2/input/javasrc/biz/xsoftware/mock In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16683/input/javasrc/biz/xsoftware/mock Modified Files: MockSuperclass.java Log Message: add more info when expecting no methods to be called fails. Index: MockSuperclass.java =================================================================== RCS file: /cvsroot/mockobject/mockobject2/input/javasrc/biz/xsoftware/mock/MockSuperclass.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MockSuperclass.java 18 Dec 2004 15:31:12 -0000 1.8 --- MockSuperclass.java 18 Dec 2004 17:49:16 -0000 1.9 *************** *** 295,299 **** o = expectUnignoredCall(method, ignorables, methodsCalledList); } catch(ExpectFailedException e) { ! throw new ExpectFailedException(e.getMessage(), cleanup(retVal, i), e.getReason()); } if(o == null) { --- 295,303 ---- o = expectUnignoredCall(method, ignorables, methodsCalledList); } catch(ExpectFailedException e) { ! if(!ExpectFailedException.UNEXPECTED_ON_NONE.equals(e.getReason())) { ! throw e; ! } ! CalledMethod[] leftOver = e.getCalledMethods(); ! throw new ExpectFailedException(e.getMessage(), leftOver, e.getReason()); } if(o == null) { *************** *** 324,328 **** private String putTogetherReason(String[] methods, Map ignorables, List methodsCalled, String lastLine) { ! String reason = "Methods you expected...\n"; for(int i = 0; i < methods.length; i++) { reason += "method["+i+"]="+methods[i]+"\n"; --- 328,332 ---- private String putTogetherReason(String[] methods, Map ignorables, List methodsCalled, String lastLine) { ! String reason = "\nMethods you expected...\n"; for(int i = 0; i < methods.length; i++) { reason += "method["+i+"]="+methods[i]+"\n"; *************** *** 365,371 **** log.log(Level.FINE, "method expected="+NONE+" on obj="+this); LeftOverMethods leftOver = getLeftOverMethods(ignorables); ! if(leftOver != null) ! throw new ExpectFailedException("A method that wasn't expected(nor ignored) was\n" ! +"called earlier. method(s)="+leftOver, null, ExpectFailedException.UNEXPECTED_ON_NONE); return new CalledMethod(NONE, null, null); } --- 369,378 ---- log.log(Level.FINE, "method expected="+NONE+" on obj="+this); LeftOverMethods leftOver = getLeftOverMethods(ignorables); ! if(leftOver != null) { ! String reason = "You were expecting no methods to be called, but method(s) not\n" ! +"in the ignore list were called earlier. method(s)="+leftOver; ! reason += getHowMethodWasCalled(leftOver.getMethods()[0]); ! throw new ExpectFailedException(reason, leftOver.getMethods(), ExpectFailedException.UNEXPECTED_ON_NONE); ! } return new CalledMethod(NONE, null, null); } |