You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(13) |
Aug
(151) |
Sep
(21) |
Oct
(6) |
Nov
(70) |
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(47) |
Feb
(66) |
Mar
(23) |
Apr
(115) |
May
(24) |
Jun
(53) |
Jul
(10) |
Aug
(279) |
Sep
(84) |
Oct
(149) |
Nov
(138) |
Dec
(52) |
2003 |
Jan
(22) |
Feb
(20) |
Mar
(29) |
Apr
(106) |
May
(170) |
Jun
(122) |
Jul
(70) |
Aug
(64) |
Sep
(27) |
Oct
(71) |
Nov
(49) |
Dec
(9) |
2004 |
Jan
(7) |
Feb
(38) |
Mar
(3) |
Apr
(9) |
May
(22) |
Jun
(4) |
Jul
(1) |
Aug
(2) |
Sep
(2) |
Oct
|
Nov
(15) |
Dec
(2) |
2005 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
(1) |
May
(28) |
Jun
(3) |
Jul
(11) |
Aug
(5) |
Sep
(1) |
Oct
(5) |
Nov
(2) |
Dec
(3) |
2006 |
Jan
(8) |
Feb
(3) |
Mar
(8) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Steve F. <sm...@us...> - 2003-08-22 04:32:39
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv5322/src/core/com/mockobjects/dynamic Modified Files: InvocationDispatcher.java Log Message: Further implementation for InvocationDispatcher Index: InvocationDispatcher.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/InvocationDispatcher.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- InvocationDispatcher.java 20 Aug 2003 21:47:58 -0000 1.1 +++ InvocationDispatcher.java 20 Aug 2003 22:38:40 -0000 1.2 @@ -7,15 +7,18 @@ import java.util.ArrayList; import java.util.Iterator; +import java.util.ListIterator; -public class InvocationDispatcher { +import com.mockobjects.Verifiable; + +public class InvocationDispatcher implements Verifiable { private ArrayList invokables = new ArrayList(); public Object dispatch(Invocation invocation) throws Throwable { - Iterator i = invokables.iterator(); - while (i.hasNext()) { - Invokable invokable = (Invokable)i.next(); + ListIterator i = invokables.listIterator(invokables.size()); + while (i.hasPrevious()) { + Invokable invokable = (Invokable)i.previous(); if (invokable.matches(invocation)) { return invokable.invoke(invocation); } @@ -25,6 +28,17 @@ public void add(Invokable invokable) { invokables.add(invokable); + } + + public void verify() { + Iterator i = invokables.iterator(); + while (i.hasNext()) { + ((Verifiable)i.next()).verify(); + } + } + + public void clear() { + invokables.clear(); } } |
From: Steve F. <sm...@us...> - 2003-08-22 04:30:13
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv5322/src/core/test/mockobjects/dynamic Modified Files: InvocationDispatcherTest.java MockInvokable.java Log Message: Further implementation for InvocationDispatcher Index: InvocationDispatcherTest.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/InvocationDispatcherTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- InvocationDispatcherTest.java 20 Aug 2003 21:48:24 -0000 1.1 +++ InvocationDispatcherTest.java 20 Aug 2003 22:38:40 -0000 1.2 @@ -16,7 +16,8 @@ private Invocation invocation; private InvocationDispatcher dispatcher; - private MockInvokable invokable = new MockInvokable(); + private MockInvokable invokable1 = new MockInvokable(); + private MockInvokable invokable2 = new MockInvokable(); public void setUp() throws NoSuchMethodException { invocation = new Invocation(getDummyMethod(), null); @@ -36,32 +37,129 @@ fail("expected AssertionFailedError"); } - public void testInvokesOneMatchingInvokable() throws Throwable { + public void testInvokesInvokableThatMatches() throws Throwable { Object result = "invoke result"; - invokable.matchesInvocation.setExpected(invocation); - invokable.matchesResult = true; - invokable.invokeInvocation.setExpected(invocation); - invokable.invokeResult = result; + invokable1.matchesInvocation.setExpected(invocation); + invokable1.matchesResult = true; + invokable1.invokeInvocation.setExpected(invocation); + invokable1.invokeResult = result; - dispatcher.add( invokable ); + dispatcher.add( invokable1 ); dispatcher.dispatch(invocation); - invokable.verify(); + invokable1.verifyExpectations(); } public void testReturnsValueFromInvokable() throws Throwable { Object result = "invoke result"; - invokable.matchesResult = true; - invokable.invokeResult = result; + invokable1.matchesResult = true; + invokable1.invokeResult = result; - dispatcher.add( invokable ); + dispatcher.add( invokable1 ); assertSame( "should be same result", result, dispatcher.dispatch(invocation) ); } + public void testPropagatesExceptionFromInvokable() throws Throwable { + Throwable exception = new Throwable("test throwable"); + + invokable1.matchesResult = true; + invokable1.invokeThrow = exception; + + dispatcher.add( invokable1 ); + + try { + dispatcher.dispatch(invocation); + fail("expected exception"); + } + catch( Throwable t ) { + assertSame( "should be same exception", exception, t ); + } + } + + public void testInvokeFailsWhenNoInvokablesMatch() throws Throwable { + invokable1.matchesResult = false; + invokable2.matchesResult = false; + + dispatcher.add( invokable1 ); + dispatcher.add( invokable2 ); + + try { + dispatcher.dispatch(invocation); + } + catch( DynamicMockError ex ) { + assertSame("should be same invocation", invocation, ex.invocation); + return; + } + fail("expected AssertionFailedError"); + } + + public void testLaterInvokablesOverrideEarlierInvokables() throws Throwable { + invokable1.matchesInvocation.setExpectNothing(); + invokable1.matchesResult = true; + invokable1.invokeInvocation.setExpectNothing(); + + invokable2.matchesInvocation.setExpected(invocation); + invokable2.matchesResult = true; + invokable2.invokeInvocation.setExpected(invocation); + + + dispatcher.add( invokable1 ); + dispatcher.add( invokable2 ); + + dispatcher.dispatch( invocation ); + + verifyInvokables(); + } + + public void testSearchesForMatchInLIFOOrder() throws Throwable { + invokable1.matchesInvocation.setExpected(invocation); + invokable1.matchesResult = true; + invokable1.invokeInvocation.setExpected(invocation); + invokable1.invokeResult = "one"; + + invokable2.matchesInvocation.setExpected(invocation); + invokable2.matchesResult = false; + invokable2.invokeInvocation.setExpectNothing(); + + + dispatcher.add( invokable1 ); + dispatcher.add( invokable2 ); + + assertEquals("Should be invokable1", "one", dispatcher.dispatch( invocation )); + + verifyInvokables(); + } + + public void testVerifiesAllInvokables() { + invokable1.verifyCalls.setExpected(1); + invokable2.verifyCalls.setExpected(1); + + dispatcher.add( invokable1 ); + dispatcher.add( invokable2 ); + + dispatcher.verify(); + + verifyInvokables(); + } + + public void testClearRemovesAllInvokables() throws Throwable { + invokable1.matchesResult = true; + + dispatcher.add( invokable1 ); + + dispatcher.clear(); + testInvokeFailsWhenEmpty(); + } + private Method getDummyMethod() throws NoSuchMethodException { return getClass().getDeclaredMethod("dummyMethod", new Class[0]); } + + private void verifyInvokables() { + invokable1.verifyExpectations(); + invokable2.verifyExpectations(); + } } Index: MockInvokable.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/MockInvokable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MockInvokable.java 20 Aug 2003 21:48:24 -0000 1.1 +++ MockInvokable.java 20 Aug 2003 22:38:41 -0000 1.2 @@ -4,29 +4,46 @@ */ package test.mockobjects.dynamic; +import com.mockobjects.ExpectationCounter; import com.mockobjects.ExpectationValue; -import com.mockobjects.MockObject; import com.mockobjects.dynamic.Invocation; import com.mockobjects.dynamic.Invokable; +import com.mockobjects.util.Verifier; -public class MockInvokable extends MockObject implements Invokable { +public class MockInvokable implements Invokable { public boolean matchesResult; public ExpectationValue matchesInvocation = new ExpectationValue("matches.invocation"); public Object invokeResult; public ExpectationValue invokeInvocation = new ExpectationValue("invoke.invocation"); + public Throwable invokeThrow; + public ExpectationCounter verifyCalls = new ExpectationCounter("verify.calls"); + public String getDescription() { return null; } + public boolean matches(Invocation invocation) { matchesInvocation.setActual(invocation); return matchesResult; } + public Object invoke(Invocation invocation) throws Throwable { invokeInvocation.setActual(invocation); + if (invokeThrow != null) { + throw invokeThrow; + } return invokeResult; } + public void verify() { + verifyCalls.inc(); + } + + public void verifyExpectations() { + Verifier.verifyObject(this); + } + } |
From: Steve F. <sm...@us...> - 2003-08-21 08:03:08
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv29451/src/core/com/mockobjects/dynamic Added Files: Expectation.java InvocationDispatcher.java Invokable.java Stub.java DynamicMockError.java Log Message: New classes for Invocation-based refactoring --- NEW FILE: Expectation.java --- /* * Created on 20-Aug-2003 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package com.mockobjects.dynamic; import com.mockobjects.Verifiable; /** * An object that checks expectations of an Invokable object. * * @author montagu */ public interface Expectation extends Verifiable { boolean matches( Invocation invocation ); void check( Invocation invocation ); } --- NEW FILE: InvocationDispatcher.java --- /* * Created on 20-Aug-2003 * Copyright mockobjects.com * */ package com.mockobjects.dynamic; import java.util.ArrayList; import java.util.Iterator; public class InvocationDispatcher { private ArrayList invokables = new ArrayList(); public Object dispatch(Invocation invocation) throws Throwable { Iterator i = invokables.iterator(); while (i.hasNext()) { Invokable invokable = (Invokable)i.next(); if (invokable.matches(invocation)) { return invokable.invoke(invocation); } } throw new DynamicMockError(invocation, "Nothing matches on this mock"); } public void add(Invokable invokable) { invokables.add(invokable); } } --- NEW FILE: Invokable.java --- package com.mockobjects.dynamic; import com.mockobjects.Verifiable; public interface Invokable extends Verifiable { String getDescription(); boolean matches(Invocation invocation); Object invoke(Invocation invocation) throws Throwable; } --- NEW FILE: DynamicMockError.java --- /* * Created on 20-Aug-2003 * * Copyright mockobjects.com */ package com.mockobjects.dynamic; import junit.framework.AssertionFailedError; public class DynamicMockError extends AssertionFailedError { public final Invocation invocation; public DynamicMockError(Invocation invocation, String message) { super(message); this.invocation = invocation; } } |
From: Jeff M. <je...@cu...> - 2003-08-20 14:04:14
|
---------------------------------------------------- This email is autogenerated from the output from: <http://cvs.apache.org/builds/gump/2003-08-20/mockobjects-servlet24.html> ---------------------------------------------------- Buildfile: build.xml project-properties: useful-file-patterns: source-locations: check-availabilities: [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. call-me-first: [echo] --------- Mock Objects 20030820 --------- [echo] java.class.path = /home/rubys/jakarta/xml-xerces2/java/build/xmlParserAPIs.jar:/home/rubys/jakarta/xml-xerces2/java/build/xercesImpl.jar:.:/usr/java/j2sdk1.4.1_02/lib/tools.jar:/usr/java/j2sdk1.4.1_02/jre/lib/rt.jar:/usr/java/j2sdk1.4.1_02/lib/tools.jar:/home/rubys/jakarta/ant/dist/lib/ant.jar:/home/rubys/jakarta/ant/dist/lib/ant-launcher.jar:/home/rubys/jakarta/ant/dist/lib/ant-jmf.jar:/home/rubys/jakarta/ant/dist/lib/ant-junit.jar:/home/rubys/jakarta/ant/dist/lib/ant-stylebook.jar:/home/rubys/jakarta/ant/dist/lib/ant-swing.jar:/home/rubys/jakarta/ant/dist/lib/ant-trax.jar:/home/rubys/jakarta/ant/dist/lib/ant-xalan2.jar:/home/rubys/jakarta/ant/dist/lib/nodeps.jar:/home/rubys/jakarta/dist/junit/junit.jar:/opt/jaf-1.0.1/activation.jar:/home/rubys/jakarta/jakarta-servletapi-5/jsr152/dist/lib/jsp-api.jar:/home/rubys/jakarta/jakarta-servletapi-5/jsr154/dist/lib/servlet-api.jar:/opt/javamail-1.3/mail.jar:/opt/jms1.0.2/lib/jms.jar:/home/rubys/jakarta/mockobjects/out/core/classes:/home/rubys/jakarta/mockobjects/out/jdk/classes [echo] java.home = /usr/java/j2sdk1.4.1_02/jre [echo] user.home = /home/rubys [echo] ant.home = ${ant.home} compile-core: compile-jdk: compile-j2ee: [javac] Compiling 49 source files to /home/rubys/jakarta/mockobjects/out/j2ee/classes [javac] /home/rubys/jakarta/mockobjects/src/j2ee/common/com/mockobjects/servlet/MockPageContext.java:12: com.mockobjects.servlet.MockPageContext should be declared abstract; it does not define getVariableResolver() in javax.servlet.jsp.JspContext [javac] public class MockPageContext extends PageContext implements Verifiable { [javac] ^ [javac] Note: /home/rubys/jakarta/mockobjects/src/j2ee/common/com/mockobjects/servlet/MockServletContext.java uses or overrides a deprecated API. [javac] Note: Recompile with -deprecation for details. [javac] 1 error BUILD FAILED /home/rubys/jakarta/mockobjects/build.xml:157: Compile failed; see the compiler error output for details. Total time: 6 seconds |
From: Jeff M. <cus...@us...> - 2003-08-19 21:03:04
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet In directory sc8-pr-cvs1:/tmp/cvs-serv23104/src/j2ee/common/com/mockobjects/servlet Added Files: CommonMockPageContext.java Removed Files: MockPageContext.java Log Message: Move concreate implementation of MockPageContext to j2ee1.3 area --- NEW FILE: CommonMockPageContext.java --- package com.mockobjects.servlet; import com.mockobjects.Verifiable; import com.mockobjects.util.AssertMo; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.JspWriter; import javax.servlet.*; import javax.servlet.http.HttpSession; import java.util.Enumeration; /** * @version $Revision: 1.1 $ */ public abstract class CommonMockPageContext extends PageContext implements Verifiable { private JspWriter jspWriter; private ServletRequest request; private HttpSession httpSession; private ServletContext servletContext; public void release(){ } public JspWriter getOut(){ return jspWriter; } public void setJspWriter(JspWriter jspWriter){ this.jspWriter = jspWriter; } public void handlePageException(Exception e){ } public ServletContext getServletContext(){ return servletContext; } public void setServletContext(ServletContext servletContext){ this.servletContext = servletContext; } public int getAttributesScope(String s){ return -1; } public void include(String s){ } /** * method required for servlet 2.4 spec * not implemented */ public void include(String relativeUrlPath, boolean flush){ AssertMo.notImplemented(getClass().getName()); } public void removeAttribute(String s, int i){ } public Enumeration getAttributeNamesInScope(int i){ return null; } public void forward(String s){ } public Object getPage(){ return null; } public void handlePageException(Throwable t){ } public void setRequest(ServletRequest servletRequest){ this.request = servletRequest; } public ServletRequest getRequest(){ return request; } public ServletResponse getResponse(){ return null; } public void removeAttribute(String s){ } public Object getAttribute(String s, int i){ return null; } public ServletConfig getServletConfig(){ return null; } public void initialize(Servlet servlet, ServletRequest servletRequest, ServletResponse servletResponse, String s, boolean b, int i, boolean b2){ } public Object findAttribute(String s) { return null; } public HttpSession getSession() { return httpSession; } public void setSession(HttpSession httpSession) { this.httpSession = httpSession; } public void setAttribute(String s, Object o){ } public void setAttribute(String s, Object o, int i) { } public Object getAttribute(String s) { return null; } public Exception getException() { return null; } public void verify(){} } --- MockPageContext.java DELETED --- |
From: Jeff M. <cus...@us...> - 2003-08-19 21:03:03
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.3/com/mockobjects/helpers In directory sc8-pr-cvs1:/tmp/cvs-serv23104/src/j2ee/1.3/com/mockobjects/helpers Modified Files: TagTestHelper.java Log Message: Move concreate implementation of MockPageContext to j2ee1.3 area Index: TagTestHelper.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.3/com/mockobjects/helpers/TagTestHelper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TagTestHelper.java 12 Aug 2003 13:32:18 -0000 1.3 +++ TagTestHelper.java 19 Aug 2003 15:50:20 -0000 1.4 @@ -3,6 +3,7 @@ import com.mockobjects.servlet.MockBodyContent; import com.mockobjects.servlet.MockJspWriter; import com.mockobjects.servlet.MockPageContext; +import com.mockobjects.servlet.CommonMockPageContext; import junit.framework.Assert; import javax.servlet.jsp.JspException; @@ -65,7 +66,7 @@ return outWriter; } - public MockPageContext getPageContext() { + public CommonMockPageContext getPageContext() { return pageContext; } |
From: Jeff M. <cus...@us...> - 2003-08-19 21:01:23
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.3/com/mockobjects/servlet In directory sc8-pr-cvs1:/tmp/cvs-serv23104/src/j2ee/1.3/com/mockobjects/servlet Added Files: MockPageContext.java Log Message: Move concreate implementation of MockPageContext to j2ee1.3 area --- NEW FILE: MockPageContext.java --- package com.mockobjects.servlet; public class MockPageContext extends CommonMockPageContext { } |
From: Jeff M. <je...@cu...> - 2003-08-19 09:57:43
|
---------------------------------------------------- This email is autogenerated from the output from: <http://cvs.apache.org/builds/gump/2003-08-19/mockobjects-servlet24.html> ---------------------------------------------------- Buildfile: build.xml project-properties: useful-file-patterns: source-locations: check-availabilities: [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. call-me-first: [echo] --------- Mock Objects 20030819 --------- [echo] java.class.path = /home/rubys/jakarta/xml-xerces2/java/build/xmlParserAPIs.jar:/home/rubys/jakarta/xml-xerces2/java/build/xercesImpl.jar:.:/usr/java/j2sdk1.4.1_02/lib/tools.jar:/usr/java/j2sdk1.4.1_02/jre/lib/rt.jar:/usr/java/j2sdk1.4.1_02/lib/tools.jar:/home/rubys/jakarta/ant/dist/lib/ant.jar:/home/rubys/jakarta/ant/dist/lib/ant-launcher.jar:/home/rubys/jakarta/ant/dist/lib/ant-jmf.jar:/home/rubys/jakarta/ant/dist/lib/ant-junit.jar:/home/rubys/jakarta/ant/dist/lib/ant-stylebook.jar:/home/rubys/jakarta/ant/dist/lib/ant-swing.jar:/home/rubys/jakarta/ant/dist/lib/ant-trax.jar:/home/rubys/jakarta/ant/dist/lib/ant-xalan2.jar:/home/rubys/jakarta/ant/dist/lib/nodeps.jar:/home/rubys/jakarta/dist/junit/junit.jar:/opt/jaf-1.0.1/activation.jar:/home/rubys/jakarta/jakarta-servletapi-5/jsr152/dist/lib/jsp-api.jar:/home/rubys/jakarta/jakarta-servletapi-5/jsr154/dist/lib/servlet-api.jar:/opt/javamail-1.3/mail.jar:/opt/jms1.0.2/lib/jms.jar:/home/rubys/jakarta/mockobjects/out/core/classes:/home/rubys/jakarta/mockobjects/out/jdk/classes [echo] java.home = /usr/java/j2sdk1.4.1_02/jre [echo] user.home = /home/rubys [echo] ant.home = ${ant.home} compile-core: compile-jdk: compile-j2ee: [javac] Compiling 49 source files to /home/rubys/jakarta/mockobjects/out/j2ee/classes [javac] /home/rubys/jakarta/mockobjects/src/j2ee/common/com/mockobjects/servlet/MockPageContext.java:12: com.mockobjects.servlet.MockPageContext should be declared abstract; it does not define getVariableResolver() in javax.servlet.jsp.JspContext [javac] public class MockPageContext extends PageContext implements Verifiable { [javac] ^ [javac] Note: /home/rubys/jakarta/mockobjects/src/j2ee/common/com/mockobjects/servlet/MockServletContext.java uses or overrides a deprecated API. [javac] Note: Recompile with -deprecation for details. [javac] 1 error BUILD FAILED /home/rubys/jakarta/mockobjects/build.xml:157: Compile failed; see the compiler error output for details. Total time: 6 seconds |
From: Steve F. <sm...@us...> - 2003-08-16 10:38:18
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/jms In directory sc8-pr-cvs1:/tmp/cvs-serv8074/src/j2ee/common/com/mockobjects/jms Modified Files: MockQueueSession.java Log Message: Corrected spelling of receiver Index: MockQueueSession.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/jms/MockQueueSession.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- MockQueueSession.java 11 Aug 2003 09:14:38 -0000 1.4 +++ MockQueueSession.java 16 Aug 2003 10:31:26 -0000 1.5 @@ -7,7 +7,7 @@ public class MockQueueSession extends MockSession implements QueueSession { private final ExpectationValue queue = new ExpectationValue("queue"); private final ReturnObjectMap queueToReturn = new ReturnObjectMap("queue"); - private final ReturnObjectBag myReceiver = new ReturnObjectBag("reciever"); + private final ReturnObjectBag myReceiver = new ReturnObjectBag("receiver"); private final ReturnObjectMap mySender = new ReturnObjectMap("sender"); private final ReturnValue myTemporaryQueue = new ReturnValue("temporary queue"); private final ReturnObjectMap queueBrowser = new ReturnObjectMap("queue browser"); |
From: SADER, K. D (Contractor) <KEI...@DF...> - 2003-08-15 19:19:34
|
Thank you thank you thank you. It was hiding in plain sight. Where = might have I missed this in the documentation or examples? > -----Original Message----- > From: Vincent Tenc=E9 [mailto:Vin...@ge...] > Sent: Friday, August 15, 2003 1:44 PM > To: SADER, KEITH D (Contractor); > moc...@li... > Subject: RE: [MO-java-dev] FW: [MO-java-users] ClassCastException when > sending mocks. >=20 >=20 > I guess you have to change =20 > request.expectAndReturn("getSession", session); > for > request.expectAndReturn("getSession", session.proxy()); > in your setUp(). >=20 > The class cast fails since Mock is not an HttpSession, but=20 > Mock.proxy() is ... >=20 > -- Vincent |
From: <Vin...@ge...> - 2003-08-15 19:09:09
|
I guess you have to change request.expectAndReturn("getSession", session); for request.expectAndReturn("getSession", session.proxy()); in your setUp(). The class cast fails since Mock is not an HttpSession, but Mock.proxy() is ... -- Vincent > -----Original Message----- > From: moc...@li... > [mailto:moc...@li...]On Behalf Of > SADER, KEITH D (Contractor) > Sent: Friday, August 15, 2003 2:09 PM > To: moc...@li... > Subject: [MO-java-dev] FW: [MO-java-users] ClassCastException when > sending mocks. > > > Forwarding to the dev list, since I've seen no traffic on the > user list. > > Summer vacations must be going well :-) > -----Original Message----- > From: SADER, KEITH D (Contractor) > Sent: Tuesday, August 12, 2003 11:12 AM > To: moc...@li... > Subject: [MO-java-users] ClassCastException when sending mocks. > > > Greetings. > > I've got the following test case: > > //Hand waving declarations... > > Mock request; > Mock response; > Mock session; > > protected void setUp() throws Exception > { > action = new MyAction();// Struts based action... > mapping = new ActionMapping();// More struts... > form = new DynaActionForm();// Isn't struts grand? > request = new Mock(HttpServletRequest.class); > response = new Mock(HttpServletResponse.class); > session = new Mock(HttpSession.class); > > request.expectAndReturn("getSession", session); > } > > public void testSessionIsInRequest() throws Exception > { > ActionForward expected = new ActionForward("success", > "path", false); > ActionForward actual = action.doExecute(mapping, form, > (HttpServletRequest)request.proxy(), > (HttpServletResponse)response.proxy()); > assertEquals(expected.getName(), actual.getName()); > request.verify(); > response.verify(); > session.verify(); > } > > // Code under test... > public ActionForwad doExecute(ActionMapping mapping, > ActionForm form, HttpServletRequest request, > HttpServletResponse response) throws Exception > { > HttpSession sess = request.getSession(); > return mapping.findForward("success"); > } > > The problem I'm having is that the code in doExecute throws a > ClassCastException on request. > java.lang.ClassCastException: com.mockobjects.dynamic.Mock > at $Proxy24.getSession()(Unknown Source) > ...doExecute() > ...testSessionIsInRequest() > > > What am I doing wrong here? By my interpretation of the > examples this code *should* work. > What am I missing? > > thanks, > --- > Keith Sader > Nash Resources Group sub-contracting for Computer Sciences Corporation > IAD:TFAS > Email:kei...@df... > We've got a blind date with destiny, and it looks like she > ordered the lobster. > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet _072303_01/01 _______________________________________________ Mockobjects-java-dev mailing list Moc...@li... https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |
From: SADER, K. D (Contractor) <KEI...@DF...> - 2003-08-15 18:17:23
|
Forwarding to the dev list, since I've seen no traffic on the user list. Summer vacations must be going well :-) -----Original Message----- From: SADER, KEITH D (Contractor)=20 Sent: Tuesday, August 12, 2003 11:12 AM To: moc...@li... Subject: [MO-java-users] ClassCastException when sending mocks. Greetings. I've got the following test case: //Hand waving declarations... Mock request; Mock response; Mock session; protected void setUp() throws Exception { action =3D new MyAction();// Struts based action... mapping =3D new ActionMapping();// More struts... form =3D new DynaActionForm();// Isn't struts grand? request =3D new Mock(HttpServletRequest.class); response =3D new Mock(HttpServletResponse.class); session =3D new Mock(HttpSession.class); request.expectAndReturn("getSession", session); } public void testSessionIsInRequest() throws Exception { ActionForward expected =3D new ActionForward("success", "path", = false); ActionForward actual =3D action.doExecute(mapping, form, (HttpServletRequest)request.proxy(), = (HttpServletResponse)response.proxy()); assertEquals(expected.getName(), actual.getName()); request.verify(); response.verify(); session.verify(); } // Code under test... public ActionForwad doExecute(ActionMapping mapping, ActionForm form, = HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession sess =3D request.getSession(); return mapping.findForward("success"); } The problem I'm having is that the code in doExecute throws a = ClassCastException on request. java.lang.ClassCastException: com.mockobjects.dynamic.Mock at $Proxy24.getSession()(Unknown Source) ...doExecute() ...testSessionIsInRequest() What am I doing wrong here? By my interpretation of the examples this = code *should* work. What am I missing? thanks, --- Keith Sader Nash Resources Group sub-contracting for Computer Sciences Corporation IAD:TFAS Email:kei...@df... We've got a blind date with destiny, and it looks like she ordered the = lobster. |
From: Kasey C. <tms...@ne...> - 2003-08-15 06:36:26
|
<html> <body bgcolor=3D"#ffffff"> <center> <font face=3D"verdana" size=3D"1" color=3D"#000000"><a href=3D"http://www.= go-mtg.com/mortgage/conf/rm.html"<font face=3D"verdana" size=3D"1" color=3D= "#999999">click here </a>to be removed from future mailings.</font><br> <table border=3D"0" cellpadding=3D"3" cellspacing=3D"0"> <tr> <td bgcolor=3D"#000000"> <table bgcolor=3D"#FFFBE0" border=3D"0" width=3D"470" cellpadding=3D"8"= cellspacing=3D"0"> <tr> <td align=3D"center"> <a href=3D"http://www.go-mtg.com/mortgage/conf/"><font face=3D"verda= na" size=3D"5" color=3D"#ff0000"><b>Conference Calls</font> <br><font face=3D"verdana" size=3D"4" color=3D"#ff0000"><i>Only 15 C= ents Per Min.</a></i></b> <br> (Long Distance Included) </font></td> </tr> <tr> <td align=3D"left"> <font face=3D"verdana" size=3D"2" color=3D"#000000">We offer an extr= emely easy to use conferencing service that only costs a fraction of what most companies charge. <br> <br> <b>No Set-up Fees <br> No Contracts or Monthly Fees </font> </td> </tr> </b> <tr> <td align=3D"center"> <font face=3D"verdana" size=3D"3 color=3D"#000000"><b>Also Broadcast Y= our Conference Call Over <br>The Internet - Only <u>8 Cents</u> Per Minute= <br>Great For International Participants. </font></td></tr> <tr> <td align=3D"center"> <a href=3D"http://www.go-mtg.com/mortgage/conf/"><font face=3D"verdana= " size=3D"4" color=3D"#ff0000"><b>Click Here For More Info</b></font></a> </font></td> </tr> </table> </td> </tr> </table> </center> </body> </html> io gndoj r g bivowrftmqfkbf plcmbues nlbvm txir xvge mn wwjx wr zc zqi oserf pe |
From: Jeff M. <je...@cu...> - 2003-08-13 10:42:56
|
---------------------------------------------------- This email is autogenerated from the output from: <http://cvs.apache.org/builds/gump/2003-08-13/mockobjects.html> ---------------------------------------------------- Buildfile: build.xml project-properties: useful-file-patterns: source-locations: check-availabilities: [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. call-me-first: [echo] --------- Mock Objects 20030813 --------- [echo] java.class.path = /home/rubys/jakarta/xml-xerces2/java/build/xmlParserAPIs.jar:/home/rubys/jakarta/xml-xerces2/java/build/xercesImpl.jar:.:/usr/java/j2sdk1.4.1_02/lib/tools.jar:/usr/java/j2sdk1.4.1_02/jre/lib/rt.jar:/usr/java/j2sdk1.4.1_02/lib/tools.jar:/home/rubys/jakarta/ant/dist/lib/ant.jar:/home/rubys/jakarta/ant/dist/lib/ant-launcher.jar:/home/rubys/jakarta/ant/dist/lib/ant-jmf.jar:/home/rubys/jakarta/ant/dist/lib/ant-junit.jar:/home/rubys/jakarta/ant/dist/lib/ant-stylebook.jar:/home/rubys/jakarta/ant/dist/lib/ant-swing.jar:/home/rubys/jakarta/ant/dist/lib/ant-trax.jar:/home/rubys/jakarta/ant/dist/lib/ant-xalan2.jar:/home/rubys/jakarta/ant/dist/lib/nodeps.jar:/home/rubys/jakarta/dist/junit/junit.jar:/opt/jaf-1.0.1/activation.jar:/home/rubys/jakarta/jakarta-servletapi-5/jsr152/dist/lib/jsp-api.jar:/home/rubys/jakarta/jakarta-servletapi-5/jsr154/dist/lib/servlet-api.jar:/opt/javamail-1.3/mail.jar:/opt/jms1.0.2/lib/jms.jar:/home/rubys/jakarta/mockobjects/out/core/classes:/home/rubys/jakarta/mockobjects/out/jdk/classes [echo] java.home = /usr/java/j2sdk1.4.1_02/jre [echo] user.home = /home/rubys [echo] ant.home = ${ant.home} compile-core: [javac] Compiling 105 source files to /home/rubys/jakarta/mockobjects/out/core/classes compile-jdk: [javac] Compiling 45 source files to /home/rubys/jakarta/mockobjects/out/jdk/classes [javac] Note: Some input files use or override a deprecated API. [javac] Note: Recompile with -deprecation for details. compile-j2ee: [mkdir] Created dir: /home/rubys/jakarta/mockobjects/out/j2ee/classes [javac] Compiling 49 source files to /home/rubys/jakarta/mockobjects/out/j2ee/classes [javac] /home/rubys/jakarta/mockobjects/src/j2ee/common/com/mockobjects/servlet/MockPageContext.java:12: com.mockobjects.servlet.MockPageContext should be declared abstract; it does not define getVariableResolver() in javax.servlet.jsp.JspContext [javac] public class MockPageContext extends PageContext implements Verifiable { [javac] ^ [javac] Note: /home/rubys/jakarta/mockobjects/src/j2ee/common/com/mockobjects/servlet/MockServletContext.java uses or overrides a deprecated API. [javac] Note: Recompile with -deprecation for details. [javac] 1 error BUILD FAILED /home/rubys/jakarta/mockobjects/build.xml:157: Compile failed; see the compiler error output for details. Total time: 10 seconds |
From: Jeff M. <cus...@us...> - 2003-08-12 13:41:54
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.3/com/mockobjects/helpers In directory sc8-pr-cvs1:/tmp/cvs-serv3334/src/j2ee/1.3/com/mockobjects/helpers Modified Files: TagTestHelper.java Log Message: Added test method to help testing iterator tags Index: TagTestHelper.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/1.3/com/mockobjects/helpers/TagTestHelper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TagTestHelper.java 14 May 2003 15:15:11 -0000 1.2 +++ TagTestHelper.java 12 Aug 2003 13:32:18 -0000 1.3 @@ -9,13 +9,16 @@ import javax.servlet.jsp.tagext.BodyTag; import javax.servlet.jsp.tagext.IterationTag; import javax.servlet.jsp.tagext.Tag; +import javax.servlet.ServletRequest; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpSession; /** * Sets up mock tag objects in a common configuration. * MockHttpServletRequest, MockServletContext and MockHttpSession are attached to MockPageContext - * @see com.mockobjects.servlet.MockPageContext#setRequest(); - * @see com.mockobjects.servlet.MockPageContext#setServletContext(); - * @see com.mockobjects.servlet.MockPageContext#setSession(); + * @see MockPageContext#setRequest(ServletRequest) + * @see MockPageContext#setServletContext(ServletContext) + * @see MockPageContext#setSession(HttpSession) */ public class TagTestHelper extends AbstractServletTestHelper { private final MockPageContext pageContext = new MockPageContext(); @@ -112,4 +115,39 @@ Assert.assertEquals("doEndTag returned unexpected value" + getReturnValueName(expectedValue), expectedValue, testSubject.doEndTag()); } + + /** + * Executes a test vistor against the test subject empulating the use of an iterator tag in a JSP engine. + * @param test testcase to be run for each iteration + * @param iterations total number of expected iterations + * @throws Exception + */ + public void testIteration(IterationTest test, int iterations) throws Exception { + + this.assertDoStartTag(BodyTag.EVAL_BODY_INCLUDE); + this.testDoInitBody(); + + int iteration = 0; + for (; iteration < iterations - 1; iteration++) { + test.doTest(iteration); + this.assertDoAfterBody(BodyTag.EVAL_BODY_AGAIN); + } + test.doTest(iteration); + this.assertDoAfterBody(BodyTag.SKIP_BODY); + + this.assertDoEndTag(BodyTag.EVAL_PAGE); + } + + /** + * Vistor used for testing IteratorTags + */ + public interface IterationTest { + /** + * Test method called for each iteration + * @param iteration index of the current iteration + * @throws Exception + */ + public void doTest(int iteration) throws Exception; + } + } |
From: Jeff M. <cus...@us...> - 2003-08-12 12:26:19
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet In directory sc8-pr-cvs1:/tmp/cvs-serv25169/src/j2ee/common/com/mockobjects/servlet Modified Files: MockJspWriter.java Log Message: Make MockJspWriter verifiable Index: MockJspWriter.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet/MockJspWriter.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- MockJspWriter.java 23 Jan 2003 12:05:27 -0000 1.4 +++ MockJspWriter.java 12 Aug 2003 12:26:16 -0000 1.5 @@ -1,13 +1,14 @@ package com.mockobjects.servlet; import com.mockobjects.ExpectationValue; +import com.mockobjects.Verifiable; import com.mockobjects.util.AssertMo; import javax.servlet.jsp.JspWriter; import java.io.PrintWriter; import java.io.StringWriter; -public class MockJspWriter extends JspWriter { +public class MockJspWriter extends JspWriter implements Verifiable { private final ExpectationValue expectedData = new ExpectationValue("data"); private StringWriter stringWriter = new StringWriter(); private PrintWriter printWriter = new PrintWriter(stringWriter); @@ -20,7 +21,7 @@ expectedData.setExpected(data); } - private final void notImplemented(){ + private final void notImplemented() { AssertMo.notImplemented(this.getClass().getName()); } |
From: Jeff M. <cus...@us...> - 2003-08-12 12:17:03
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet In directory sc8-pr-cvs1:/tmp/cvs-serv23723/src/j2ee/common/com/mockobjects/servlet Modified Files: MockBodyContent.java Log Message: Remove implementation of equals Index: MockBodyContent.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet/MockBodyContent.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MockBodyContent.java 18 Mar 2003 14:28:44 -0000 1.2 +++ MockBodyContent.java 12 Aug 2003 12:16:50 -0000 1.3 @@ -44,11 +44,6 @@ super.write(cbuf); } - public boolean equals(Object obj) { - notImplemented(); - return super.equals(obj); - } - public void clearBody() { notImplemented(); super.clearBody(); |
From: Jeff M. <cus...@us...> - 2003-08-12 12:16:15
|
Update of /cvsroot/mockobjects/mockobjects-java In directory sc8-pr-cvs1:/tmp/cvs-serv23637 Modified Files: build.xml Log Message: Added check for j2ee 1.4 Index: build.xml =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/build.xml,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- build.xml 18 Jun 2003 10:30:01 -0000 1.39 +++ build.xml 12 Aug 2003 12:16:12 -0000 1.40 @@ -76,6 +76,9 @@ <available property="j2ee.version" value="1.3" classpathref="lib.classpath" classname="javax.servlet.Filter" /> + <available property="j2ee.version" value="1.4" + classpathref="lib.classpath" + classname="javax.servlet.jsp.ErrorData" /> <available property="httpclient" value="true" classpathref="lib.classpath" classname="org.apache.commons.httpclient.HttpClient" /> |
From: Jeff M. <je...@cu...> - 2003-08-12 10:55:53
|
---------------------------------------------------- This email is autogenerated from the output from: <http://cvs.apache.org/builds/gump/2003-08-12/mockobjects.html> ---------------------------------------------------- Buildfile: build.xml project-properties: useful-file-patterns: source-locations: check-availabilities: [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. [available] DEPRECATED - <available> used to override an existing property. [available] Build file should not reuse the same property name for different values. call-me-first: [echo] --------- Mock Objects 20030812 --------- [echo] java.class.path = /home/rubys/jakarta/xml-xerces2/java/build/xmlParserAPIs.jar:/home/rubys/jakarta/xml-xerces2/java/build/xercesImpl.jar:.:/usr/java/j2sdk1.4.1_02/lib/tools.jar:/usr/java/j2sdk1.4.1_02/jre/lib/rt.jar:/usr/java/j2sdk1.4.1_02/lib/tools.jar:/home/rubys/jakarta/ant/dist/lib/ant.jar:/home/rubys/jakarta/ant/dist/lib/ant-launcher.jar:/home/rubys/jakarta/ant/dist/lib/ant-jmf.jar:/home/rubys/jakarta/ant/dist/lib/ant-junit.jar:/home/rubys/jakarta/ant/dist/lib/ant-stylebook.jar:/home/rubys/jakarta/ant/dist/lib/ant-swing.jar:/home/rubys/jakarta/ant/dist/lib/ant-trax.jar:/home/rubys/jakarta/ant/dist/lib/ant-xalan2.jar:/home/rubys/jakarta/ant/dist/lib/nodeps.jar:/home/rubys/jakarta/dist/junit/junit.jar:/opt/jaf-1.0.1/activation.jar:/home/rubys/jakarta/jakarta-servletapi-5/jsr152/dist/lib/jsp-api.jar:/home/rubys/jakarta/jakarta-servletapi-5/jsr154/dist/lib/servlet-api.jar:/opt/javamail-1.3/mail.jar:/opt/jms1.0.2/lib/jms.jar:/home/rubys/jakarta/mockobjects/out/core/classes:/home/rubys/jakarta/mockobjects/out/jdk/classes [echo] java.home = /usr/java/j2sdk1.4.1_02/jre [echo] user.home = /home/rubys [echo] ant.home = ${ant.home} compile-core: [javac] Compiling 105 source files to /home/rubys/jakarta/mockobjects/out/core/classes compile-jdk: [javac] Compiling 45 source files to /home/rubys/jakarta/mockobjects/out/jdk/classes [javac] Note: Some input files use or override a deprecated API. [javac] Note: Recompile with -deprecation for details. compile-j2ee: [mkdir] Created dir: /home/rubys/jakarta/mockobjects/out/j2ee/classes [javac] Compiling 64 source files to /home/rubys/jakarta/mockobjects/out/j2ee/classes [javac] /home/rubys/jakarta/mockobjects/src/j2ee/common/com/mockobjects/servlet/MockPageContext.java:12: com.mockobjects.servlet.MockPageContext should be declared abstract; it does not define getVariableResolver() in javax.servlet.jsp.JspContext [javac] public class MockPageContext extends PageContext implements Verifiable { [javac] ^ [javac] /home/rubys/jakarta/mockobjects/src/j2ee/1.3/com/mockobjects/servlet/MockHttpServletRequest.java:20: com.mockobjects.servlet.MockHttpServletRequest should be declared abstract; it does not define getLocalName() in com.mockobjects.servlet.MockHttpServletRequest [javac] public class MockHttpServletRequest extends MockObject [javac] ^ [javac] /home/rubys/jakarta/mockobjects/src/j2ee/1.3/com/mockobjects/servlet/MockHttpServletResponse.java:12: com.mockobjects.servlet.MockHttpServletResponse should be declared abstract; it does not define setCharacterEncoding(java.lang.String) in com.mockobjects.servlet.MockHttpServletResponse [javac] public class MockHttpServletResponse extends MockObject [javac] ^ [javac] Note: Some input files use or override a deprecated API. [javac] Note: Recompile with -deprecation for details. [javac] 3 errors BUILD FAILED /home/rubys/jakarta/mockobjects/build.xml:154: Compile failed; see the compiler error output for details. Total time: 11 seconds |
From: Steve F. <sm...@us...> - 2003-08-11 21:25:09
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv30756/src/core/com/mockobjects/dynamic Modified Files: CoreMock.java Log Message: Added support for proxies testing equality with null Thanks to Richard Burgess Index: CoreMock.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/CoreMock.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- CoreMock.java 9 Aug 2003 13:18:30 -0000 1.7 +++ CoreMock.java 11 Aug 2003 21:25:06 -0000 1.8 @@ -65,8 +65,10 @@ } private boolean isCheckingEqualityOnProxy(Invocation invocation) { - return (invocation.getMethodName().equals("equals")) && (invocation.args.length == 1) && - (Proxy.isProxyClass(invocation.args[0].getClass())); + return invocation.getMethodName().equals("equals") + && invocation.args.length == 1 + && invocation.args[0] != null + && Proxy.isProxyClass(invocation.args[0].getClass()); } private boolean isMockNameGetter(Invocation invocation) { |
From: Steve F. <sm...@us...> - 2003-08-11 21:25:09
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv30756/src/core/test/mockobjects/dynamic Modified Files: CoreMockTest.java Log Message: Added support for proxies testing equality with null Thanks to Richard Burgess Index: CoreMockTest.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/CoreMockTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CoreMockTest.java 9 Jul 2003 23:54:20 -0000 1.2 +++ CoreMockTest.java 11 Aug 2003 21:25:07 -0000 1.3 @@ -111,15 +111,24 @@ Verifier.verifyObject(this); } - public void testProxyInequality() throws Exception { + public void testProxyInequality() throws Exception { mockCallables.callResult = new Boolean(false); mockCallables.addExpectedCall("equals", new Object[] {"not a proxy"}); - - assertFalse("Should handle proxy inequality by calling through", proxy.equals("not a proxy")); - - Verifier.verifyObject(this); - } + + assertFalse("Should handle proxy inequality by calling through", proxy.equals("not a proxy")); + + Verifier.verifyObject(this); + } + + public void testProxyEqualityWithNull() throws Exception { + mockCallables.callResult = new Boolean(true); + mockCallables.addExpectedCall("equals", new Object[] {null}); + + assertTrue("Proxy should handle null equality", proxy.equals(null)); + + Verifier.verifyObject(this); + } public void testCallingGetMockNameOnProxyReturnsNameOfUnderlyingMock() { mockCallables.setExpectedCallCalls(0); |
From: Steve F. <sm...@us...> - 2003-08-11 21:24:34
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv30601/src/core/test/mockobjects/dynamic Modified Files: DynamicUtilTest.java Log Message: removed unnecessary code Index: DynamicUtilTest.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/DynamicUtilTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- DynamicUtilTest.java 11 Aug 2003 21:12:55 -0000 1.3 +++ DynamicUtilTest.java 11 Aug 2003 21:24:31 -0000 1.4 @@ -58,10 +58,7 @@ } public void testMethodToStringWithNullArg() throws Exception { - Mock mockDummyInterface = new Mock(DummyInterface.class, "DummyMock"); - Object[] args = new Object[] {null}; - - String result = DynamicUtil.methodToString("methodName", args); + String result = DynamicUtil.methodToString("methodName", new Object[] {null}); AssertMo.assertIncludes("Should contain method name", "methodName", result); AssertMo.assertIncludes("Should contain firstArg", "<null>", result); |
From: Steve F. <sm...@us...> - 2003-08-11 21:20:32
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv27053/src/core/com/mockobjects/dynamic Modified Files: DynamicUtil.java Log Message: fixed null pointer bug in DynamicUtil. Thanks to Richard Burgess Index: DynamicUtil.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/DynamicUtil.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- DynamicUtil.java 6 Jul 2003 22:45:24 -0000 1.5 +++ DynamicUtil.java 11 Aug 2003 21:12:55 -0000 1.6 @@ -115,7 +115,9 @@ Object element = elements[i]; - if (element.getClass().isArray()) { + if (null == element) { + buf.append("<null>"); + } else if (element.getClass().isArray()) { buf.append("["); join(asObjectArray(element), buf); buf.append("]"); |
From: Steve F. <sm...@us...> - 2003-08-11 21:19:46
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv27053/src/core/test/mockobjects/dynamic Modified Files: DynamicUtilTest.java Log Message: fixed null pointer bug in DynamicUtil. Thanks to Richard Burgess Index: DynamicUtilTest.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/DynamicUtilTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DynamicUtilTest.java 18 May 2003 20:59:39 -0000 1.2 +++ DynamicUtilTest.java 11 Aug 2003 21:12:55 -0000 1.3 @@ -57,4 +57,13 @@ AssertMo.assertIncludes("Should contain second Arg", "DummyMock", result); } + public void testMethodToStringWithNullArg() throws Exception { + Mock mockDummyInterface = new Mock(DummyInterface.class, "DummyMock"); + Object[] args = new Object[] {null}; + + String result = DynamicUtil.methodToString("methodName", args); + + AssertMo.assertIncludes("Should contain method name", "methodName", result); + AssertMo.assertIncludes("Should contain firstArg", "<null>", result); + } } |
From: Jeff M. <cus...@us...> - 2003-08-11 09:52:56
|
Update of /cvsroot/mockobjects/mockobjects-java/src/extensions/com/mockobjects/apache/commons/httpclient In directory sc8-pr-cvs1:/tmp/cvs-serv24799/src/extensions/com/mockobjects/apache/commons/httpclient Modified Files: MockGetMethod.java MockMethodHelper.java Added Files: MockPutMethod.java Log Message: Added support for PUT in HTTPClient mocks --- NEW FILE: MockPutMethod.java --- package com.mockobjects.apache.commons.httpclient; import com.mockobjects.*; import com.mockobjects.util.AssertMo; import com.mockobjects.util.Verifier; import org.apache.commons.httpclient.*; import org.apache.commons.httpclient.methods.PutMethod; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; public class MockPutMethod extends PutMethod implements Verifiable { private ExpectationValue myFollowRedirects; // lazy initialise because of super constructor private ExpectationSet myPairs = new ExpectationSet("pairs"); private ReturnObjectList myStatusCodes = new ReturnObjectList("status code"); private String myResponseBody; private String myStatusText; private final MockMethodHelper helper = new MockMethodHelper(); private final ExpectationValue requestBody = new ExpectationValue("request body"); public void setExpectedPath(String aPath) { helper.setExpectedPath(aPath); } public void setPath(String aPath) { helper.setPath(aPath); } public void setExpectedFollowRedirects(boolean aFollowRedirects) { if (myFollowRedirects == null) { myFollowRedirects = new ExpectationValue("follow redirects"); } myFollowRedirects.setExpected(aFollowRedirects); } public void setFollowRedirects(boolean aFollowRedirects) { if (myFollowRedirects == null) { myFollowRedirects = new ExpectationValue("follow redirects"); } myFollowRedirects.setActual(aFollowRedirects); } public void addExpectedQueryString(NameValuePair aPair) { myPairs.addExpected(new MapEntry(aPair.getName(), aPair.getValue())); } public void setQueryString(NameValuePair[] aPairs) { for (int i = 0; i < aPairs.length; i++) { myPairs.addActual(new MapEntry( aPairs[i].getName(), aPairs[i].getValue())); } } public void setupGetResponseBodyAsString(String aResponseBody) { myResponseBody = aResponseBody; } public String getResponseBodyAsString() { return myResponseBody; } public void addGetStatusCode(int aStatusCode) { myStatusCodes.addObjectToReturn(new Integer(aStatusCode)); } public int getStatusCode() { return ((Integer) myStatusCodes.nextReturnObject()).intValue(); } public void setupGetStatusText(String aStatusText) { myStatusText = aStatusText; } public String getStatusText() { return myStatusText; } public Header getResponseHeader(String key) { return helper.getResponseHeader(key); } public void addGetResponseHeader(String key, Header header) { helper.addGetResponseHeader(key, header); } private void notImplemented() { AssertMo.notImplemented(getClass().getName()); } public String getName() { notImplemented(); return null; } public void recycle() { notImplemented(); } public void verify() { Verifier.verifyObject(this); } public void setRequestBody(File file) throws IOException { notImplemented(); } public void setRequestBody(URL url) throws IOException { notImplemented(); } public void setRequestBody(byte[] bytes) { notImplemented(); } public void setRequestBody(String body) { requestBody.setActual(body); } public void setExpectedRequestBody(String body) { requestBody.setExpected(body); } public void setRequestBody(InputStream inputStream) throws IOException { notImplemented(); } protected void addRequestHeaders(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { notImplemented(); } protected boolean writeRequestBody(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { notImplemented(); return false; } protected int getRequestContentLength() { notImplemented(); return 0; } public String getPath() { return helper.getPath(); } public void setStrictMode(boolean b) { helper.setStrictMode(b); } public boolean isStrictMode() { return helper.isStrictMode(); } public void setRequestHeader(String s, String s1) { helper.setRequestHeader(s, s1); } public void setRequestHeader(Header header) { helper.setRequestHeader(header); } public void addRequestHeader(String s, String s1) { helper.addRequestHeader(s, s1); } public void addRequestHeader(Header header) { helper.addRequestHeader(header); } public Header getRequestHeader(String s) { return helper.getRequestHeader(s); } public void removeRequestHeader(String s) { helper.removeRequestHeader(s); } public boolean getFollowRedirects() { return helper.getFollowRedirects(); } public void setQueryString(String s) { helper.setQueryString(s); } public String getQueryString() { return helper.getQueryString(); } public Header[] getRequestHeaders() { return helper.getRequestHeaders(); } public boolean validate() { return helper.validate(); } public Header[] getResponseHeaders() { return helper.getResponseHeaders(); } public byte[] getResponseBody() { return helper.getResponseBody(); } public InputStream getResponseBodyAsStream() throws IOException { return helper.getResponseBodyAsStream(); } public boolean hasBeenUsed() { return helper.hasBeenUsed(); } public int execute(HttpState httpState, HttpConnection httpConnection) throws HttpException, IOException { return helper.execute(httpState, httpConnection); } protected void writeRequest(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { helper.writeRequest(httpState, httpConnection); } protected void writeRequestLine(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { helper.writeRequestLine(httpState, httpConnection); } protected void writeRequestHeaders(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { helper.writeRequestHeaders(httpState, httpConnection); } protected void addUserAgentRequestHeader(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { helper.addUserAgentRequestHeader(httpState, httpConnection); } protected void addHostRequestHeader(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { helper.addHostRequestHeader(httpState, httpConnection); } protected void addCookieRequestHeader(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { helper.addCookieRequestHeader(httpState, httpConnection); } protected void addAuthorizationRequestHeader(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { helper.addAuthorizationRequestHeader(httpState, httpConnection); } protected void addContentLengthRequestHeader(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { helper.addContentLengthRequestHeader(httpState, httpConnection); } protected void readResponse(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { helper.readResponse(httpState, httpConnection); } protected void readStatusLine(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { helper.readStatusLine(httpState, httpConnection); } protected void processStatusLine(HttpState httpState, HttpConnection httpConnection) { helper.processStatusLine(httpState, httpConnection); } protected void readResponseHeaders(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { helper.readResponseHeaders(httpState, httpConnection); } protected void processResponseHeaders(HttpState httpState, HttpConnection httpConnection) { helper.processResponseHeaders(httpState, httpConnection); } protected void readResponseBody(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { helper.readResponseBody(httpState, httpConnection); } protected void readResponseBody(HttpState httpState, HttpConnection httpConnection, OutputStream outputStream) throws IOException { helper.readResponseBody(httpState, httpConnection, outputStream); } protected void processResponseBody(HttpState httpState, HttpConnection httpConnection) { helper.processResponseBody(httpState, httpConnection); } public boolean isHttp11() { return helper.isHttp11(); } public void setHttp11(boolean b) { helper.setHttp11(b); } protected void checkNotUsed() { helper.checkNotUsed(); } protected void checkUsed() { helper.checkUsed(); } } Index: MockGetMethod.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/extensions/com/mockobjects/apache/commons/httpclient/MockGetMethod.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- MockGetMethod.java 14 May 2003 15:07:35 -0000 1.3 +++ MockGetMethod.java 11 Aug 2003 09:52:53 -0000 1.4 @@ -13,7 +13,6 @@ public class MockGetMethod extends GetMethod implements Verifiable { private ExpectationValue myFollowRedirects; // lazy initialise because of super constructor - private ExpectationValue myPath = new ExpectationValue("path"); private ExpectationSet myPairs = new ExpectationSet("pairs"); private ReturnObjectList myStatusCodes = new ReturnObjectList("status code"); private String myResponseBody; @@ -21,86 +20,86 @@ private final MockMethodHelper helper = new MockMethodHelper(); public void setExpectedPath(String aPath) { - myPath.setExpected(aPath); + helper.setExpectedPath(aPath); } public void setPath(String aPath) { - myPath.setActual(aPath); + helper.setPath(aPath); } public String getPath() { - AssertMo.notImplemented(getClass().getName()); - return null; + return helper.getPath(); } public void setStrictMode(boolean b) { - AssertMo.notImplemented(getClass().getName()); + helper.setStrictMode(b); } public boolean isStrictMode() { - AssertMo.notImplemented(getClass().getName()); - return false; + return helper.isStrictMode(); } public void setRequestHeader(String s, String s1) { - AssertMo.notImplemented(getClass().getName()); + helper.setRequestHeader(s, s1); } public void setUseDisk(boolean b) { + notImplemented(); + } + + private void notImplemented() { AssertMo.notImplemented(getClass().getName()); } public void setRequestHeader(Header header) { - AssertMo.notImplemented(getClass().getName()); + helper.setRequestHeader(header); } public boolean getUseDisk() { - AssertMo.notImplemented(getClass().getName()); + notImplemented(); return false; } public void addRequestHeader(String s, String s1) { - AssertMo.notImplemented(getClass().getName()); + helper.addRequestHeader(s, s1); } public void setTempDir(String s) { - AssertMo.notImplemented(getClass().getName()); + notImplemented(); } public void addRequestHeader(Header header) { - AssertMo.notImplemented(getClass().getName()); + helper.addRequestHeader(header); } public String getTempDir() { - AssertMo.notImplemented(getClass().getName()); + notImplemented(); return null; } public Header getRequestHeader(String s) { - AssertMo.notImplemented(getClass().getName()); - return null; + return helper.getRequestHeader(s); } public void setTempFile(String s) { - AssertMo.notImplemented(getClass().getName()); + notImplemented(); } public void removeRequestHeader(String s) { - AssertMo.notImplemented(getClass().getName()); + helper.removeRequestHeader(s); } public String getTempFile() { - AssertMo.notImplemented(getClass().getName()); + notImplemented(); return null; } public boolean getFollowRedirects() { - AssertMo.notImplemented(getClass().getName()); - return false; + return helper.getFollowRedirects(); } public File getFileData() { - AssertMo.notImplemented(getClass().getName()); + notImplemented(); return null; } @@ -119,15 +118,15 @@ } public void setFileData(File file) { - AssertMo.notImplemented(getClass().getName()); + notImplemented(); } public void setQueryString(String s) { - AssertMo.notImplemented(getClass().getName()); + helper.setQueryString(s); } public String getName() { - AssertMo.notImplemented(getClass().getName()); + notImplemented(); return null; } Index: MockMethodHelper.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/extensions/com/mockobjects/apache/commons/httpclient/MockMethodHelper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MockMethodHelper.java 14 May 2003 15:07:35 -0000 1.1 +++ MockMethodHelper.java 11 Aug 2003 09:52:53 -0000 1.2 @@ -1,14 +1,31 @@ package com.mockobjects.apache.commons.httpclient; -import com.mockobjects.ReturnObjectBag; import com.mockobjects.MockObject; +import com.mockobjects.ReturnObjectBag; +import com.mockobjects.ExpectationValue; import org.apache.commons.httpclient.Header; +import org.apache.commons.httpclient.HttpConnection; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpState; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; /** * @version $Revision$ */ class MockMethodHelper extends MockObject{ private final ReturnObjectBag header = new ReturnObjectBag("response header"); + private final ExpectationValue myPath = new ExpectationValue("path"); + + public void setExpectedPath(String aPath) { + myPath.setExpected(aPath); + } + + public void setPath(String aPath) { + myPath.setActual(aPath); + } public Header getResponseHeader(String key) { return (Header) header.getNextReturnObject(key); @@ -17,4 +34,175 @@ public void addGetResponseHeader(String key, Header header) { this.header.putObjectToReturn(key, header); } + + + public String getPath() { + notImplemented(); + return null; + } + + public void setStrictMode(boolean b) { + notImplemented(); + } + + public boolean isStrictMode() { + notImplemented(); + return false; + } + + public void setRequestHeader(String s, String s1) { + notImplemented(); + } + + public void setRequestHeader(Header header) { + notImplemented(); + } + + public void addRequestHeader(String s, String s1) { + notImplemented(); + } + + public void addRequestHeader(Header header) { + notImplemented(); + } + + public Header getRequestHeader(String s) { + notImplemented(); + return null; + } + + public void removeRequestHeader(String s) { + notImplemented(); + } + + public boolean getFollowRedirects() { + notImplemented(); + return false; + } + + public void setQueryString(String s) { + notImplemented(); + } + + public String getQueryString() { + notImplemented(); + return null; + } + + public Header[] getRequestHeaders() { + notImplemented(); + return null; + } + + public boolean validate() { + notImplemented(); + return false; + } + + public Header[] getResponseHeaders() { + notImplemented(); + return null; + } + + public byte[] getResponseBody() { + notImplemented(); + return null; + } + + public InputStream getResponseBodyAsStream() throws IOException { + notImplemented(); + return null; + } + + public boolean hasBeenUsed() { + notImplemented(); + return false; + } + + public int execute(HttpState httpState, HttpConnection httpConnection) throws HttpException, IOException { + notImplemented(); + return 0; + } + + protected void writeRequest(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { + notImplemented(); + } + + protected void writeRequestLine(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { + notImplemented(); + } + + protected void writeRequestHeaders(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { + notImplemented(); + } + + protected void addUserAgentRequestHeader(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { + notImplemented(); + } + + protected void addHostRequestHeader(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { + notImplemented(); + } + + protected void addCookieRequestHeader(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { + notImplemented(); + } + + protected void addAuthorizationRequestHeader(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { + notImplemented(); + } + + protected void addContentLengthRequestHeader(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { + notImplemented(); + } + + protected void readResponse(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { + notImplemented(); + } + + protected void readStatusLine(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { + notImplemented(); + } + + protected void processStatusLine(HttpState httpState, HttpConnection httpConnection) { + notImplemented(); + } + + protected void readResponseHeaders(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { + notImplemented(); + } + + protected void processResponseHeaders(HttpState httpState, HttpConnection httpConnection) { + notImplemented(); + } + + protected void readResponseBody(HttpState httpState, HttpConnection httpConnection) throws IOException, HttpException { + notImplemented(); + } + + protected void readResponseBody(HttpState httpState, HttpConnection httpConnection, OutputStream outputStream) throws IOException { + notImplemented(); + } + + protected void processResponseBody(HttpState httpState, HttpConnection httpConnection) { + notImplemented(); + } + + public boolean isHttp11() { + notImplemented(); + return false; + } + + public void setHttp11(boolean b) { + notImplemented(); + } + + protected void checkNotUsed() { + notImplemented(); + } + + protected void checkUsed() { + notImplemented(); + } + } |