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: Jeff M. <cus...@us...> - 2002-06-28 17:23:42
|
Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/1.4/com/mockobjects In directory usw-pr-cvs1:/tmp/cvs-serv18339/src/jdk/1.4/com/mockobjects Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/jdk/1.4/com/mockobjects added to the repository |
From: Jeff M. <cus...@us...> - 2002-06-28 17:22:55
|
Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/1.4/com In directory usw-pr-cvs1:/tmp/cvs-serv18133/src/jdk/1.4/com Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/jdk/1.4/com added to the repository |
From: Jeff M. <cus...@us...> - 2002-06-28 17:22:54
|
Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/1.3/com/mockobjects In directory usw-pr-cvs1:/tmp/cvs-serv18133/src/jdk/1.3/com/mockobjects Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/jdk/1.3/com/mockobjects added to the repository |
From: Jeff M. <cus...@us...> - 2002-06-28 17:20:59
|
Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/1.3/com In directory usw-pr-cvs1:/tmp/cvs-serv17441/src/jdk/1.3/com Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/jdk/1.3/com added to the repository |
From: Jeff M. <cus...@us...> - 2002-06-28 17:20:59
|
Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/1.4 In directory usw-pr-cvs1:/tmp/cvs-serv17441/src/jdk/1.4 Log Message: Directory /cvsroot/mockobjects/mockobjects-java/src/jdk/1.4 added to the repository |
From: Jeff M. <cus...@us...> - 2002-06-28 13:29:39
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet In directory usw-pr-cvs1:/tmp/cvs-serv5128/src/j2ee/common/com/mockobjects/servlet Modified Files: MockServletInputStream.java Log Message: Added better stream support Index: MockServletInputStream.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet/MockServletInputStream.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MockServletInputStream.java 5 Apr 2002 10:49:50 -0000 1.1 +++ MockServletInputStream.java 28 Jun 2002 13:29:33 -0000 1.2 @@ -2,16 +2,28 @@ import com.mockobjects.Verifiable; import com.mockobjects.util.Verifier; + import javax.servlet.ServletInputStream; public class MockServletInputStream extends ServletInputStream implements -Verifiable{ + Verifiable { + + private byte[] myData; + private int myIndex; - public void verify(){ + public void verify() { Verifier.verifyObject(this); } - public int read(){ - return -1; + public void setupRead(byte[] data) { + myData = data; + } + + public int read() { + if(myData!=null && myIndex < myData.length) { + return myData[myIndex++]; + } else { + return -1; + } } } |
From: Jeff M. <cus...@us...> - 2002-06-25 10:14:53
|
Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql In directory usw-pr-cvs1:/tmp/cvs-serv5636/src/jdk/common/com/mockobjects/sql Modified Files: MockConnection.java MockStatement.java Log Message: Replaced UnsupportedOperationExceptions with calls to notImplemented Changes setupResultSet to be addResult set to support multiple result sets Index: MockConnection.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/MockConnection.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MockConnection.java 19 Jun 2002 15:26:25 -0000 1.2 +++ MockConnection.java 25 Jun 2002 10:14:51 -0000 1.3 @@ -55,6 +55,7 @@ } public void clearWarnings() throws SQLException { + notImplemented(); } public void setupCloseException(SQLException aCloseException) { @@ -82,32 +83,39 @@ int resultSetType, int resultSetConcurrency) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public boolean getAutoCommit() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return false; } public String getCatalog() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public DatabaseMetaData getMetaData() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public int getTransactionIsolation() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public Map getTypeMap() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public SQLWarning getWarnings() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public void setupIsClosedException(SQLException aIsClosedException) { @@ -126,16 +134,19 @@ } public boolean isReadOnly() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return false; } public String nativeSQL(String sql) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public CallableStatement prepareCall(String sql) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public CallableStatement prepareCall( @@ -143,7 +154,8 @@ int resultSetType, int resultSetConcurrency) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public PreparedStatement prepareStatement(String sql) throws SQLException { @@ -157,7 +169,8 @@ int resultSetType, int resultSetConcurrency) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public void rollback() throws SQLException { @@ -173,20 +186,20 @@ } public void setCatalog(String catalog) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public void setReadOnly(boolean readOnly) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public void setTransactionIsolation(int level) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public void setTypeMap(Map map) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } private void throwStatementExceptionIfAny() throws SQLException { Index: MockStatement.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/MockStatement.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MockStatement.java 13 Apr 2002 15:08:23 -0000 1.1 +++ MockStatement.java 25 Jun 2002 10:14:51 -0000 1.2 @@ -8,15 +8,11 @@ protected ExpectationCounter myCloseCalls = new ExpectationCounter("MockStatement.closeCalls"); protected ExpectationCounter myExecuteCalls = new ExpectationCounter("MockStatement.executeCalls"); protected ExpectationValue myQueryString = new ExpectationValue("MockStatement.queryString"); - protected MockResultSet myResultSet; + protected ReturnObjectList myResultSets = new ReturnObjectList("result set"); private int myUpdateCount = 0; private SQLException myExecuteException = null; - public MockStatement() { - super(); - } - public void setExpectedExecuteCalls(int callCount) { myExecuteCalls.setExpected(callCount); } @@ -29,8 +25,8 @@ myCloseCalls.setExpected(callCount); } - public void setupResultSet(MockResultSet aResultSet) { - myResultSet = aResultSet; + public void addResultSet(MockResultSet aResultSet) { + myResultSets.addObjectToReturn(aResultSet); } public void setupThrowExceptionOnExecute(SQLException exception) { @@ -53,13 +49,14 @@ } public boolean execute(String sql) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return true; } public ResultSet executeQuery(String sql) throws SQLException { myQueryString.setActual(sql); innerExecute(); - return myResultSet; + return (ResultSet)myResultSets.nextReturnObject(); } public int executeUpdate(String sql) throws SQLException { @@ -69,51 +66,56 @@ } public int getMaxFieldSize() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public void setMaxFieldSize(int max) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public int getMaxRows() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public void setMaxRows(int max) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public void setEscapeProcessing(boolean enable) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public int getQueryTimeout() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public void setQueryTimeout(int seconds) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public void cancel() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public SQLWarning getWarnings() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public void clearWarnings() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public void setCursorName(String name) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public ResultSet getResultSet() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public int getUpdateCount() throws SQLException { @@ -121,47 +123,54 @@ } public boolean getMoreResults() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return false; } public void setFetchDirection(int direction) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public int getFetchDirection() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public void setFetchSize(int rows) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public int getFetchSize() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public int getResultSetConcurrency() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public int getResultSetType() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return 0; } public void addBatch(String sql) throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public void clearBatch() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); } public int[] executeBatch() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } public Connection getConnection() throws SQLException { - throw new UnsupportedOperationException(); + notImplemented(); + return null; } } |
From: Jeff M. <cus...@us...> - 2002-06-25 10:13:15
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet In directory usw-pr-cvs1:/tmp/cvs-serv5321/src/j2ee/common/com/mockobjects/servlet Modified Files: MockJspWriter.java Log Message: Added support for more print types Index: MockJspWriter.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet/MockJspWriter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MockJspWriter.java 19 Jun 2002 15:26:22 -0000 1.2 +++ MockJspWriter.java 25 Jun 2002 10:13:12 -0000 1.3 @@ -44,12 +44,12 @@ notImplemented(); } - public void print(int i) { - printWriter.print(String.valueOf(i)); + public void print(int anInt) { + printWriter.print(String.valueOf(anInt)); } - public void print(long l) { - printWriter.print(String.valueOf(l)); + public void print(long aLong) { + printWriter.print(String.valueOf(aLong)); } public void print(float f) { @@ -68,12 +68,12 @@ notImplemented(); } - public void print(String s) { - printWriter.print(s); + public void print(String aString) { + printWriter.print(aString); } - public void println(String s) { - printWriter.print(s); + public void println(String aString) { + printWriter.print(aString); } public void print(char c) { @@ -96,8 +96,8 @@ notImplemented(); } - public void print(Object o) { - notImplemented(); + public void print(Object anObject) { + printWriter.print(anObject); } public void println(long l) { @@ -125,8 +125,8 @@ return -1; } - public void println(Object o) { - notImplemented(); + public void println(Object anObject) { + printWriter.print(anObject); } public void verify() { |
From: Jeff M. <je...@cu...> - 2002-06-25 08:24:55
|
Probably should be. On Mon, 2002-06-24 at 21:38, Steve Freeman wrote: > been looking at the alt stuff. Do you think it should be in the core > release, or in another section? > > S. > > -- Jeff Martin Memetic Engineer http://www.custommonkey.org/ |
From: Vincent M. <vm...@oc...> - 2002-06-21 19:44:25
|
Hehe ... you guessed right Vincent! :-)=20 Trenton, there is a strategy complementary to mock objects when you need to test in a real container ... http://jakarta.apache.org/cactus See especially http://jakarta.apache.org/cactus/mockobjects.html which tries to compare mocks and in-container testing. -Vincent > -----Original Message----- > From: moc...@li... > [mailto:moc...@li...] On Behalf Of > Vincent Tenc=E9 > Sent: 21 June 2002 19:23 > To: 'Trenton Lipscomb'; 'MockObjects' > Subject: RE: [MO-java-dev] Common test cases >=20 > I don't know exactly what you are trying to test, but I know some guys out > there that will recommend you use Cactus ;-) if you end up having too much > functionality in your Mocks. >=20 > Vincent >=20 > > -----Original Message----- > > From: moc...@li... > > [mailto:moc...@li...]On Behalf Of > > Trenton Lipscomb > > Sent: Friday, June 21, 2002 13:35 > > To: 'Jeff Martin'; MockObjects > > Subject: RE: [MO-java-dev] Common test cases > > > > > > Basically, I think ServletContext and ServletConfig need some > > real functionality. Because of this, it precludes them from > > being a mock. They need real functionality because it's not > > sufficient to simply test that a servlet calls methods on a > > MockServletContext, or that it sets the proper attributes. I > > think you actually need real functionality here, in order to > > have the servlet progress far enough along its execution path > > to make testing useful. > > > > This is certainly true for anything we tried to do for > > ServletConfig. I frequtly do a lot of setup within my > > init(ServletConfig) method, and without a real ServletConfig, > > I can't get the servlet to a point where doing any tests on > > it are meaningful. I need a real config so that the servlet > > can init properly. Then, I can test it using > > MockServletRequests and Responses. > > > > *trenton > > > > -----Original Message----- > > From: Jeff Martin [mailto:je...@mk...] > > Sent: Friday, June 21, 2002 10:00 AM > > To: MockObjects > > Subject: RE: [MO-java-dev] Common test cases > > > > > > Sorry, not quite sure I understand. > > > > My intent for the standard test cases was just to start a by having a > > commonly use set of objects. > > > > e.g. > > > > protected final MockHttpRequest request =3D new MockHttpRequest(); > > protected final MockHttpResponse response =3D new = MockHttpResponse(); > > protected final MockServletContext context =3D new MockServletContext(); > > > > ... > > > > protected void setUp(){ > > request.setupGetServletContext(context); > > } > > > > ... > > > > protected void verify(){ > > request.verify(); > > response.verify(); > > context.verify(); > > } > > > > That kinda thing. > > > > On Wed, 2002-06-19 at 22:18, Trenton Lipscomb wrote: > > > Yes, and just to be clear, these should be partial (or even > > full) implementations of the interfaces. These won't be > > mocks, since we'll actually need the classes to fill their > > role and relay configuration data to the servlet. > > > > > > *trenton > > > > > > -----Original Message----- > > > From: Vincent Massol [mailto:vm...@oc...] > > > Sent: Wednesday, June 19, 2002 12:33 PM > > > To: Moc...@li... > > > Subject: RE: [MO-java-dev] Common test cases > > > > > > > > > +1 > > > > > > We need to make sure they are still quite generic though. > > > > > > -Vincent > > > > > > > -----Original Message----- > > > > From: moc...@li... > > > > [mailto:moc...@li...] > > On Behalf Of > > > > Jeff Martin > > > > Sent: 19 June 2002 16:48 > > > > To: MockObjects > > > > Subject: [MO-java-dev] Common test cases > > > > > > > > I've been starting to thing that it might be nice to have some > > > abstract > > > > test cases which perform common and boring setup of mock objects. > > > > > > > > Like setting up servlet requests and all those context type stuff. > > > > > > > > Thoughts/objects? > > > > -- > > > > Jeff Martin > > > > > > > > Memetic Engineer > > > > > > > > http://www.custommonkey.org/ > > > > > > > > > > > > > > > > > -------------------------------------------------------------- > > ---------- > > > -- > > > > -- > > > > Bringing you mounds of caffeinated joy > > > > >>> http://thinkgeek.com/sf <<< > > > > > > > > _______________________________________________ > > > > Mockobjects-java-dev mailing list > > > > Moc...@li... > > > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > > > > > > > > > > -------------------------------------------------------------- > > -------------- > > > Bringing you mounds of caffeinated joy > > > >>> http://thinkgeek.com/sf <<< > > > > > > _______________________________________________ > > > Mockobjects-java-dev mailing list > > > Moc...@li... > > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > > > > > > > -------------------------------------------------------------- > > -------------- > > > Bringing you mounds of caffeinated joy > > > >>> http://thinkgeek.com/sf <<< > > > > > > _______________________________________________ > > > Mockobjects-java-dev mailing list > > > Moc...@li... > > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > -- > > > > > > > > ------------------------------------------------------- > > Sponsored by: > > ThinkGeek at http://www.ThinkGeek.com/ > > _______________________________________________ > > Mockobjects-java-dev mailing list > > Moc...@li... > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > > > > > ------------------------------------------------------- > > Sponsored by: > > ThinkGeek at http://www.ThinkGeek.com/ > > _______________________________________________ > > Mockobjects-java-dev mailing list > > Moc...@li... > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev >=20 >=20 >=20 > ------------------------------------------------------- > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |
From: Jeff M. <je...@cu...> - 2002-06-21 19:19:21
|
Hmm, not sure about this. We've got some reasonably complex servlets and some really nasty filters (result of not refactoring properly) and so far we've been able to to test them using mocks. It could be of course that our tests aren't very good and that might be some of it, but I don't see that a servlet should become that complex that it cannot be tested with mocks. I'm curious to know what your actually doing and where the mocks start to fail you. So far they're implementation has been driven by my specific needs. I've consciously not implemented and method which I'm not using and trying to do the minimum necessary to implement it. This means that if I only call a method once in my code it will only support returning one value. It could be that other people need to be able to setup list of objects (ReturnObjectList) or some other method. This might be enough to resolve your problems. It could be that there's a whole different level of problems I've not come across yet in which case I'm no longer qualified to comment on an appropriate testing method. One thing I've found so far though is that complexity has been a failing of my abilities not something that was an inherent property of the problem I was trying to solve, so maybe trying to use mocks will present a different approach. Either way it would be cool if you could give us a bit more info. Right I'm off home for the weekend. See you all on Monday ttfn. On Fri, 2002-06-21 at 18:35, Trenton Lipscomb wrote: > Basically, I think ServletContext and ServletConfig need some real functionality. Because of this, it precludes them from being a mock. They need real functionality because it's not sufficient to simply test that a servlet calls methods on a MockServletContext, or that it sets the proper attributes. I think you actually need real functionality here, in order to have the servlet progress far enough along its execution path to make testing useful. > > This is certainly true for anything we tried to do for ServletConfig. I frequtly do a lot of setup within my init(ServletConfig) method, and without a real ServletConfig, I can't get the servlet to a point where doing any tests on it are meaningful. I need a real config so that the servlet can init properly. Then, I can test it using MockServletRequests and Responses. > > *trenton > > -----Original Message----- > From: Jeff Martin [mailto:je...@mk...] > Sent: Friday, June 21, 2002 10:00 AM > To: MockObjects > Subject: RE: [MO-java-dev] Common test cases > > > Sorry, not quite sure I understand. > > My intent for the standard test cases was just to start a by having a > commonly use set of objects. > > e.g. > > protected final MockHttpRequest request = new MockHttpRequest(); > protected final MockHttpResponse response = new MockHttpResponse(); > protected final MockServletContext context = new MockServletContext(); > > ... > > protected void setUp(){ > request.setupGetServletContext(context); > } > > ... > > protected void verify(){ > request.verify(); > response.verify(); > context.verify(); > } > > That kinda thing. > > On Wed, 2002-06-19 at 22:18, Trenton Lipscomb wrote: > > Yes, and just to be clear, these should be partial (or even full) implementations of the interfaces. These won't be mocks, since we'll actually need the classes to fill their role and relay configuration data to the servlet. > > > > *trenton > > > > -----Original Message----- > > From: Vincent Massol [mailto:vm...@oc...] > > Sent: Wednesday, June 19, 2002 12:33 PM > > To: Moc...@li... > > Subject: RE: [MO-java-dev] Common test cases > > > > > > +1 > > > > We need to make sure they are still quite generic though. > > > > -Vincent > > > > > -----Original Message----- > > > From: moc...@li... > > > [mailto:moc...@li...] On Behalf Of > > > Jeff Martin > > > Sent: 19 June 2002 16:48 > > > To: MockObjects > > > Subject: [MO-java-dev] Common test cases > > > > > > I've been starting to thing that it might be nice to have some > > abstract > > > test cases which perform common and boring setup of mock objects. > > > > > > Like setting up servlet requests and all those context type stuff. > > > > > > Thoughts/objects? > > > -- > > > Jeff Martin > > > > > > Memetic Engineer > > > > > > http://www.custommonkey.org/ > > > > > > > > > > > ------------------------------------------------------------------------ > > -- > > > -- > > > Bringing you mounds of caffeinated joy > > > >>> http://thinkgeek.com/sf <<< > > > > > > _______________________________________________ > > > Mockobjects-java-dev mailing list > > > Moc...@li... > > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > > > > > ---------------------------------------------------------------------------- > > Bringing you mounds of caffeinated joy > > >>> http://thinkgeek.com/sf <<< > > > > _______________________________________________ > > Mockobjects-java-dev mailing list > > Moc...@li... > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > > > ---------------------------------------------------------------------------- > > Bringing you mounds of caffeinated joy > > >>> http://thinkgeek.com/sf <<< > > > > _______________________________________________ > > Mockobjects-java-dev mailing list > > Moc...@li... > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > -- > > > > ------------------------------------------------------- > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > > ------------------------------------------------------- > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev -- Jeff Martin Memetic Engineer http://www.custommonkey.org/ |
From: <Vin...@ge...> - 2002-06-21 18:23:06
|
I don't know exactly what you are trying to test, but I know some guys out there that will recommend you use Cactus ;-) if you end up having too much functionality in your Mocks. Vincent > -----Original Message----- > From: moc...@li... > [mailto:moc...@li...]On Behalf Of > Trenton Lipscomb > Sent: Friday, June 21, 2002 13:35 > To: 'Jeff Martin'; MockObjects > Subject: RE: [MO-java-dev] Common test cases > > > Basically, I think ServletContext and ServletConfig need some > real functionality. Because of this, it precludes them from > being a mock. They need real functionality because it's not > sufficient to simply test that a servlet calls methods on a > MockServletContext, or that it sets the proper attributes. I > think you actually need real functionality here, in order to > have the servlet progress far enough along its execution path > to make testing useful. > > This is certainly true for anything we tried to do for > ServletConfig. I frequtly do a lot of setup within my > init(ServletConfig) method, and without a real ServletConfig, > I can't get the servlet to a point where doing any tests on > it are meaningful. I need a real config so that the servlet > can init properly. Then, I can test it using > MockServletRequests and Responses. > > *trenton > > -----Original Message----- > From: Jeff Martin [mailto:je...@mk...] > Sent: Friday, June 21, 2002 10:00 AM > To: MockObjects > Subject: RE: [MO-java-dev] Common test cases > > > Sorry, not quite sure I understand. > > My intent for the standard test cases was just to start a by having a > commonly use set of objects. > > e.g. > > protected final MockHttpRequest request = new MockHttpRequest(); > protected final MockHttpResponse response = new MockHttpResponse(); > protected final MockServletContext context = new MockServletContext(); > > ... > > protected void setUp(){ > request.setupGetServletContext(context); > } > > ... > > protected void verify(){ > request.verify(); > response.verify(); > context.verify(); > } > > That kinda thing. > > On Wed, 2002-06-19 at 22:18, Trenton Lipscomb wrote: > > Yes, and just to be clear, these should be partial (or even > full) implementations of the interfaces. These won't be > mocks, since we'll actually need the classes to fill their > role and relay configuration data to the servlet. > > > > *trenton > > > > -----Original Message----- > > From: Vincent Massol [mailto:vm...@oc...] > > Sent: Wednesday, June 19, 2002 12:33 PM > > To: Moc...@li... > > Subject: RE: [MO-java-dev] Common test cases > > > > > > +1 > > > > We need to make sure they are still quite generic though. > > > > -Vincent > > > > > -----Original Message----- > > > From: moc...@li... > > > [mailto:moc...@li...] > On Behalf Of > > > Jeff Martin > > > Sent: 19 June 2002 16:48 > > > To: MockObjects > > > Subject: [MO-java-dev] Common test cases > > > > > > I've been starting to thing that it might be nice to have some > > abstract > > > test cases which perform common and boring setup of mock objects. > > > > > > Like setting up servlet requests and all those context type stuff. > > > > > > Thoughts/objects? > > > -- > > > Jeff Martin > > > > > > Memetic Engineer > > > > > > http://www.custommonkey.org/ > > > > > > > > > > > > -------------------------------------------------------------- > ---------- > > -- > > > -- > > > Bringing you mounds of caffeinated joy > > > >>> http://thinkgeek.com/sf <<< > > > > > > _______________________________________________ > > > Mockobjects-java-dev mailing list > > > Moc...@li... > > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > > > > > > -------------------------------------------------------------- > -------------- > > Bringing you mounds of caffeinated joy > > >>> http://thinkgeek.com/sf <<< > > > > _______________________________________________ > > Mockobjects-java-dev mailing list > > Moc...@li... > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > > > > -------------------------------------------------------------- > -------------- > > Bringing you mounds of caffeinated joy > > >>> http://thinkgeek.com/sf <<< > > > > _______________________________________________ > > Mockobjects-java-dev mailing list > > Moc...@li... > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > -- > > > > ------------------------------------------------------- > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > > ------------------------------------------------------- > Sponsored by: > ThinkGeek at http://www.ThinkGeek.com/ > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |
From: Trenton L. <Tre...@cn...> - 2002-06-21 17:35:36
|
Basically, I think ServletContext and ServletConfig need some real functionality. Because of this, it precludes them from being a mock. They need real functionality because it's not sufficient to simply test that a servlet calls methods on a MockServletContext, or that it sets the proper attributes. I think you actually need real functionality here, in order to have the servlet progress far enough along its execution path to make testing useful. This is certainly true for anything we tried to do for ServletConfig. I frequtly do a lot of setup within my init(ServletConfig) method, and without a real ServletConfig, I can't get the servlet to a point where doing any tests on it are meaningful. I need a real config so that the servlet can init properly. Then, I can test it using MockServletRequests and Responses. *trenton -----Original Message----- From: Jeff Martin [mailto:je...@mk...] Sent: Friday, June 21, 2002 10:00 AM To: MockObjects Subject: RE: [MO-java-dev] Common test cases Sorry, not quite sure I understand. My intent for the standard test cases was just to start a by having a commonly use set of objects. e.g. protected final MockHttpRequest request = new MockHttpRequest(); protected final MockHttpResponse response = new MockHttpResponse(); protected final MockServletContext context = new MockServletContext(); ... protected void setUp(){ request.setupGetServletContext(context); } ... protected void verify(){ request.verify(); response.verify(); context.verify(); } That kinda thing. On Wed, 2002-06-19 at 22:18, Trenton Lipscomb wrote: > Yes, and just to be clear, these should be partial (or even full) implementations of the interfaces. These won't be mocks, since we'll actually need the classes to fill their role and relay configuration data to the servlet. > > *trenton > > -----Original Message----- > From: Vincent Massol [mailto:vm...@oc...] > Sent: Wednesday, June 19, 2002 12:33 PM > To: Moc...@li... > Subject: RE: [MO-java-dev] Common test cases > > > +1 > > We need to make sure they are still quite generic though. > > -Vincent > > > -----Original Message----- > > From: moc...@li... > > [mailto:moc...@li...] On Behalf Of > > Jeff Martin > > Sent: 19 June 2002 16:48 > > To: MockObjects > > Subject: [MO-java-dev] Common test cases > > > > I've been starting to thing that it might be nice to have some > abstract > > test cases which perform common and boring setup of mock objects. > > > > Like setting up servlet requests and all those context type stuff. > > > > Thoughts/objects? > > -- > > Jeff Martin > > > > Memetic Engineer > > > > http://www.custommonkey.org/ > > > > > > > ------------------------------------------------------------------------ > -- > > -- > > Bringing you mounds of caffeinated joy > > >>> http://thinkgeek.com/sf <<< > > > > _______________________________________________ > > Mockobjects-java-dev mailing list > > Moc...@li... > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > > ---------------------------------------------------------------------------- > Bringing you mounds of caffeinated joy > >>> http://thinkgeek.com/sf <<< > > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > ---------------------------------------------------------------------------- > Bringing you mounds of caffeinated joy > >>> http://thinkgeek.com/sf <<< > > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev -- ------------------------------------------------------- Sponsored by: ThinkGeek at http://www.ThinkGeek.com/ _______________________________________________ Mockobjects-java-dev mailing list Moc...@li... https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |
From: Jeff M. <je...@mk...> - 2002-06-21 17:03:58
|
Sorry, not quite sure I understand. My intent for the standard test cases was just to start a by having a commonly use set of objects. e.g. protected final MockHttpRequest request = new MockHttpRequest(); protected final MockHttpResponse response = new MockHttpResponse(); protected final MockServletContext context = new MockServletContext(); ... protected void setUp(){ request.setupGetServletContext(context); } ... protected void verify(){ request.verify(); response.verify(); context.verify(); } That kinda thing. On Wed, 2002-06-19 at 22:18, Trenton Lipscomb wrote: > Yes, and just to be clear, these should be partial (or even full) implementations of the interfaces. These won't be mocks, since we'll actually need the classes to fill their role and relay configuration data to the servlet. > > *trenton > > -----Original Message----- > From: Vincent Massol [mailto:vm...@oc...] > Sent: Wednesday, June 19, 2002 12:33 PM > To: Moc...@li... > Subject: RE: [MO-java-dev] Common test cases > > > +1 > > We need to make sure they are still quite generic though. > > -Vincent > > > -----Original Message----- > > From: moc...@li... > > [mailto:moc...@li...] On Behalf Of > > Jeff Martin > > Sent: 19 June 2002 16:48 > > To: MockObjects > > Subject: [MO-java-dev] Common test cases > > > > I've been starting to thing that it might be nice to have some > abstract > > test cases which perform common and boring setup of mock objects. > > > > Like setting up servlet requests and all those context type stuff. > > > > Thoughts/objects? > > -- > > Jeff Martin > > > > Memetic Engineer > > > > http://www.custommonkey.org/ > > > > > > > ------------------------------------------------------------------------ > -- > > -- > > Bringing you mounds of caffeinated joy > > >>> http://thinkgeek.com/sf <<< > > > > _______________________________________________ > > Mockobjects-java-dev mailing list > > Moc...@li... > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > > ---------------------------------------------------------------------------- > Bringing you mounds of caffeinated joy > >>> http://thinkgeek.com/sf <<< > > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > ---------------------------------------------------------------------------- > Bringing you mounds of caffeinated joy > >>> http://thinkgeek.com/sf <<< > > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev -- |
From: Jeff M. <je...@mk...> - 2002-06-21 15:40:11
|
Actually the thing that needs to be sorted before the release is the JDBC code under 1.4. As Scott keeps telling me the changes to the JDBC interfaces mean this code no longer compiles. My current plan is to change the MockConnection class to be AbstractConnection and mark it abstract. Then in the 1.3 and 1.4 branches I'll inherit from it. Under jdk1.4 I'll then just have to implement the abstract methods from the Connection interface. There's probably a couple of other classes that need this doing as well. Not sure when I'll get around to this. Of course someone else could alway get there first. On Wed, 2002-06-19 at 16:44, Jeff Martin wrote: > Anyone got any comments before I go ahead? > > -- > Jeff Martin > > Memetic Engineer > > http://www.custommonkey.org/ > > > ---------------------------------------------------------------------------- > Bringing you mounds of caffeinated joy > >>> http://thinkgeek.com/sf <<< > > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev -- |
From: Jeff M. <cus...@us...> - 2002-06-20 11:51:27
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet In directory usw-pr-cvs1:/tmp/cvs-serv15231/src/j2ee/common/com/mockobjects/servlet Modified Files: MockRequestDispatcher.java Log Message: Change to implement MockObject Index: MockRequestDispatcher.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet/MockRequestDispatcher.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MockRequestDispatcher.java 22 Feb 2002 16:25:05 -0000 1.1 +++ MockRequestDispatcher.java 20 Jun 2002 11:51:24 -0000 1.2 @@ -1,27 +1,35 @@ package com.mockobjects.servlet; -import java.io.IOException; -import javax.servlet.*; - -public class MockRequestDispatcher implements RequestDispatcher { - - /** - - * MockRequestDispatcher constructor comment. +import com.mockobjects.MockObject; +import com.mockobjects.ExpectationValue; - */ +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import java.io.IOException; - public MockRequestDispatcher() { +public class MockRequestDispatcher extends MockObject implements RequestDispatcher { + private final ExpectationValue myRequest = new ExpectationValue("request"); + private final ExpectationValue myResponse = new ExpectationValue("response"); - super(); + public void setExpectedRequest(ServletResponse aRequest){ + myRequest.setExpected(aRequest); + } + public void setExpectedResponse(ServletResponse aResponse){ + myResponse.setExpected(aResponse); } - public void forward(ServletRequest arg1, ServletResponse arg2) + public void forward(ServletRequest aRequest, ServletResponse aResponse) throws ServletException, IOException { + + myRequest.setActual(aRequest); } - public void include(ServletRequest arg1, ServletResponse arg2) + public void include(ServletRequest aRequest, ServletResponse aResponse) throws ServletException, IOException { + + myResponse.setActual(aResponse); } } |
From: Trenton L. <Tre...@cn...> - 2002-06-19 21:18:32
|
Yes, and just to be clear, these should be partial (or even full) implementations of the interfaces. These won't be mocks, since we'll actually need the classes to fill their role and relay configuration data to the servlet. *trenton -----Original Message----- From: Vincent Massol [mailto:vm...@oc...] Sent: Wednesday, June 19, 2002 12:33 PM To: Moc...@li... Subject: RE: [MO-java-dev] Common test cases +1 We need to make sure they are still quite generic though. -Vincent > -----Original Message----- > From: moc...@li... > [mailto:moc...@li...] On Behalf Of > Jeff Martin > Sent: 19 June 2002 16:48 > To: MockObjects > Subject: [MO-java-dev] Common test cases > > I've been starting to thing that it might be nice to have some abstract > test cases which perform common and boring setup of mock objects. > > Like setting up servlet requests and all those context type stuff. > > Thoughts/objects? > -- > Jeff Martin > > Memetic Engineer > > http://www.custommonkey.org/ > > > ------------------------------------------------------------------------ -- > -- > Bringing you mounds of caffeinated joy > >>> http://thinkgeek.com/sf <<< > > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev ---------------------------------------------------------------------------- Bringing you mounds of caffeinated joy >>> http://thinkgeek.com/sf <<< _______________________________________________ Mockobjects-java-dev mailing list Moc...@li... https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |
From: Vincent M. <vm...@oc...> - 2002-06-19 19:37:21
|
+1 -Vincent > -----Original Message----- > From: moc...@li... > [mailto:moc...@li...] On Behalf Of > Jeff Martin > Sent: 19 June 2002 16:45 > To: MockObjects > Subject: [MO-java-dev] Time for a release? > > Anyone got any comments before I go ahead? > > -- > Jeff Martin > > Memetic Engineer > > http://www.custommonkey.org/ > > > ------------------------------------------------------------------------ -- > -- > Bringing you mounds of caffeinated joy > >>> http://thinkgeek.com/sf <<< > > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |
From: Vincent M. <vm...@oc...> - 2002-06-19 19:37:17
|
+1 We need to make sure they are still quite generic though. -Vincent > -----Original Message----- > From: moc...@li... > [mailto:moc...@li...] On Behalf Of > Jeff Martin > Sent: 19 June 2002 16:48 > To: MockObjects > Subject: [MO-java-dev] Common test cases > > I've been starting to thing that it might be nice to have some abstract > test cases which perform common and boring setup of mock objects. > > Like setting up servlet requests and all those context type stuff. > > Thoughts/objects? > -- > Jeff Martin > > Memetic Engineer > > http://www.custommonkey.org/ > > > ------------------------------------------------------------------------ -- > -- > Bringing you mounds of caffeinated joy > >>> http://thinkgeek.com/sf <<< > > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |
From: Trenton L. <Tre...@cn...> - 2002-06-19 17:27:04
|
Yes, that'd be great. I've had to create a couple of stubs/light implementations of a ServletContext and ServletConfig to get my mock servlet testing to work. Even then, I have some problems because I do a lot of init for my servlet. *trenton -----Original Message----- From: Jeff Martin [mailto:je...@cu...] Sent: Wednesday, June 19, 2002 8:48 AM To: MockObjects Subject: [MO-java-dev] Common test cases I've been starting to thing that it might be nice to have some abstract test cases which perform common and boring setup of mock objects. Like setting up servlet requests and all those context type stuff. Thoughts/objects? -- Jeff Martin Memetic Engineer http://www.custommonkey.org/ ---------------------------------------------------------------------------- Bringing you mounds of caffeinated joy >>> http://thinkgeek.com/sf <<< _______________________________________________ Mockobjects-java-dev mailing list Moc...@li... https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |
From: Jeff M. <je...@cu...> - 2002-06-19 15:51:57
|
I've been starting to thing that it might be nice to have some abstract test cases which perform common and boring setup of mock objects. Like setting up servlet requests and all those context type stuff. Thoughts/objects? -- Jeff Martin Memetic Engineer http://www.custommonkey.org/ |
From: Jeff M. <je...@cu...> - 2002-06-19 15:48:30
|
Anyone got any comments before I go ahead? -- Jeff Martin Memetic Engineer http://www.custommonkey.org/ |
From: Jeff M. <cus...@us...> - 2002-06-19 15:26:55
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet In directory usw-pr-cvs1:/tmp/cvs-serv12913/src/j2ee/common/com/mockobjects/servlet Modified Files: MockJspWriter.java MockServletContext.java Added Files: MockBodyContent.java Log Message: Lots of small changes to mocks --- NEW FILE: MockBodyContent.java --- package com.mockobjects.servlet; import com.mockobjects.util.AssertMo; import com.mockobjects.Verifiable; import com.mockobjects.ExpectationValue; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.tagext.BodyContent; import java.io.IOException; import java.io.Reader; import java.io.Writer; public class MockBodyContent extends BodyContent implements Verifiable{ private JspWriter myEnclosingWriter; private final ExpectationValue myWriter = new ExpectationValue("writer"); public int getBufferSize() { notImplemented(); return super.getBufferSize(); } public MockBodyContent() { super(null); } public void write(int c) throws IOException { notImplemented(); super.write(c); } public void flush() throws IOException { notImplemented(); super.flush(); } public boolean isAutoFlush() { notImplemented(); return super.isAutoFlush(); } public void write(char cbuf[]) throws IOException { notImplemented(); super.write(cbuf); } public boolean equals(Object obj) { notImplemented(); return super.equals(obj); } public void clearBody() { notImplemented(); super.clearBody(); } public void write(String str) throws IOException { notImplemented(); super.write(str); } public void setupGetEnclosingWriter(JspWriter aJspWriter){ myEnclosingWriter = aJspWriter; } public JspWriter getEnclosingWriter() { return myEnclosingWriter; } private void notImplemented() { AssertMo.notImplemented(MockBodyContent.class.getName()); } public Reader getReader() { notImplemented(); return null; } public void newLine() throws IOException { notImplemented(); } public void write(char cbuf[], int off, int len) throws IOException { notImplemented(); } public void print(boolean b) throws IOException { notImplemented(); } public void setExpectedWriteOut(Writer aWriter){ myWriter.setExpected(aWriter); } public void writeOut(Writer aWriter) throws IOException { myWriter.setActual(aWriter); } public void print(char c) throws IOException { notImplemented(); } public void print(int i) throws IOException { notImplemented(); } public void print(long l) throws IOException { notImplemented(); } public void print(float v) throws IOException { notImplemented(); } public void print(double v) throws IOException { notImplemented(); } public void print(char[] chars) throws IOException { notImplemented(); } public void print(String s) throws IOException { notImplemented(); } public void print(Object o) throws IOException { notImplemented(); } public void println() throws IOException { notImplemented(); } public void println(boolean b) throws IOException { notImplemented(); } public void println(char c) throws IOException { notImplemented(); } public void println(int i) throws IOException { notImplemented(); } public void println(long l) throws IOException { notImplemented(); } public void println(float v) throws IOException { notImplemented(); } public void println(double v) throws IOException { notImplemented(); } public void println(char[] chars) throws IOException { notImplemented(); } public void println(String s) throws IOException { notImplemented(); } public void println(Object o) throws IOException { notImplemented(); } public void clear() throws IOException { notImplemented(); } public void clearBuffer() throws IOException { notImplemented(); } public void close() throws IOException { notImplemented(); } public int getRemaining() { notImplemented(); return 0; } public void write(String str, int off, int len) throws IOException { notImplemented(); super.write(str, off, len); } public String getString() { notImplemented(); return null; } public void verify() { } } Index: MockJspWriter.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet/MockJspWriter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MockJspWriter.java 23 Feb 2002 18:50:35 -0000 1.1 +++ MockJspWriter.java 19 Jun 2002 15:26:22 -0000 1.2 @@ -1,86 +1,135 @@ package com.mockobjects.servlet; -import javax.servlet.*; -import javax.servlet.http.*; -import javax.servlet.jsp.*; -import junit.framework.*; -import junit.textui.*; -import java.util.*; -import java.io.*; -import java.net.*; -import com.mockobjects.*; +import com.mockobjects.ExpectationValue; +import com.mockobjects.util.AssertMo; -public class MockJspWriter extends JspWriter{ +import javax.servlet.jsp.JspWriter; +import java.io.PrintWriter; +import java.io.StringWriter; + +public class MockJspWriter extends JspWriter { private ExpectationValue expectedData = new ExpectationValue("data"); private StringWriter stringWriter = new StringWriter(); private PrintWriter printWriter = new PrintWriter(stringWriter); - public MockJspWriter(){ + public MockJspWriter() { super(0, true); } - public void setExpectedData(String data){ + public void setExpectedData(String data) { expectedData.setExpected(data); } - public void newLine(){ + private final void notImplemented(){ + AssertMo.notImplemented(this.getClass().getName()); + } + + public void newLine() { + notImplemented(); } public void flush() { + notImplemented(); } - public void print(double d){ + + public void print(double d) { + printWriter.print(String.valueOf(d)); } - public void println(){ + + public void println() { + notImplemented(); } - public void close(){ + + public void close() { + notImplemented(); } - public void print(int i){ + + public void print(int i) { + printWriter.print(String.valueOf(i)); } - public void print(long l){ + + public void print(long l) { + printWriter.print(String.valueOf(l)); } - public void print(float f){ + + public void print(float f) { + notImplemented(); } - public void println(char c){ + + public void println(char c) { + notImplemented(); } - public void clear(){ + + public void clear() { + notImplemented(); } - public void print(boolean b){ + + public void print(boolean b) { + notImplemented(); } - public void print(String s){ + + public void print(String s) { printWriter.print(s); } - public void println(String s){ + + public void println(String s) { printWriter.print(s); } - public void print(char c){ + + public void print(char c) { + notImplemented(); } + public void write(char[] c, int i1, int i2) { + notImplemented(); } - public void println(char[] c){ + + public void println(char[] c) { + notImplemented(); } - public void println(boolean b){ + + public void println(boolean b) { + notImplemented(); } - public void clearBuffer(){ + + public void clearBuffer() { + notImplemented(); } - public void print(Object o){ + + public void print(Object o) { + notImplemented(); } - public void println(long l){ + + public void println(long l) { + notImplemented(); } - public void println(int i){ + + public void println(int i) { + notImplemented(); } - public void print(char[] c){ + + public void print(char[] c) { + notImplemented(); } - public void println(float f){ + + public void println(float f) { + notImplemented(); } - public void println(double d){ + + public void println(double d) { + notImplemented(); } - public int getRemaining(){ + + public int getRemaining() { + notImplemented(); return -1; } - public void println(Object o){ + + public void println(Object o) { + notImplemented(); } - public void verify(){ + public void verify() { printWriter.flush(); expectedData.setActual(stringWriter.toString()); expectedData.verify(); Index: MockServletContext.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/servlet/MockServletContext.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- MockServletContext.java 28 Mar 2002 18:16:54 -0000 1.2 +++ MockServletContext.java 19 Jun 2002 15:26:22 -0000 1.3 @@ -9,7 +9,7 @@ public class MockServletContext extends MockObject implements ServletContext{ private HashMap attributes = new HashMap(); private Set resourcePaths; - private List realPaths = new ArrayList(); + private ReturnObjectList realPaths = new ReturnObjectList("real path"); private URL resource; private HashMap initParameters = new HashMap(); private ExpectationValue expectedLogValue = new ExpectationValue("log"); @@ -68,11 +68,11 @@ } public void addRealPath(String realPath){ - this.realPaths.add(realPath); + this.realPaths.addObjectToReturn(realPath); } public String getRealPath(String string){ - return realPaths.remove(0).toString(); + return realPaths.nextReturnObject().toString(); } public Enumeration getServletNames(){ |
From: Jeff M. <cus...@us...> - 2002-06-19 15:26:55
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/mail In directory usw-pr-cvs1:/tmp/cvs-serv12913/src/j2ee/common/com/mockobjects/mail Modified Files: MockTransport.java Added Files: MockMessage.java Log Message: Lots of small changes to mocks --- NEW FILE: MockMessage.java --- package com.mockobjects.mail; import alt.javax.mail.Message; import javax.mail.Address; import javax.mail.MessagingException; import javax.mail.Flags; import javax.mail.Multipart; import javax.activation.DataHandler; import java.util.Date; import java.util.Enumeration; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import com.mockobjects.MockObject; import com.mockobjects.ExpectationValue; public class MockMessage extends MockObject implements Message { private final ExpectationValue myFrom = new ExpectationValue("from"); private final ExpectationValue myRecipients = new ExpectationValue("recipients"); private final ExpectationValue mySubject = new ExpectationValue("subject"); private final ExpectationValue mySentDate = new ExpectationValue("sent date"); private final ExpectationValue myText = new ExpectationValue("text"); private final ExpectationValue myContent = new ExpectationValue("content"); private final ExpectationValue myMimeType = new ExpectationValue("mime type"); public Address[] getFrom() throws MessagingException { notImplemented(); return new Address[0]; } public void setFrom() throws MessagingException { notImplemented(); } public void setExpectedFrom(Address anAddress){ myFrom.setExpected(anAddress); } public void setFrom(Address anAddress) throws MessagingException { myFrom.setActual(anAddress); } public void addFrom(Address[] addresses) throws MessagingException { notImplemented(); } public Address[] getRecipients(javax.mail.Message.RecipientType type) throws MessagingException { notImplemented(); return new Address[0]; } public void setExpectedRecipients(Address[] addresses){ myRecipients.setExpected(addresses); } public void setRecipients(javax.mail.Message.RecipientType type, Address[] addresses) throws MessagingException { myRecipients.setActual(addresses); } public void addRecipients(javax.mail.Message.RecipientType type, Address[] addresses) throws MessagingException { notImplemented(); } public String getSubject() throws MessagingException { notImplemented(); return null; } public void setSubject(String aSubject) throws MessagingException { mySubject.setActual(aSubject); } public void setExpectedSubject(String aSubject){ mySubject.setExpected(aSubject); } public Date getSentDate() throws MessagingException { notImplemented(); return null; } public void setExpectedSentDate(Date aDate){ mySentDate.setExpected(aDate); } public void setSentDate(Date aDate) throws MessagingException { mySentDate.setActual(aDate); } public Date getReceivedDate() throws MessagingException { notImplemented(); return null; } public Flags getFlags() throws MessagingException { notImplemented(); return null; } public void setFlags(Flags flags, boolean b) throws MessagingException { notImplemented(); } public Message reply(boolean b) throws MessagingException { notImplemented(); return null; } public void saveChanges() throws MessagingException { notImplemented(); } public int getSize() throws MessagingException { notImplemented(); return 0; } public int getLineCount() throws MessagingException { notImplemented(); return 0; } public String getContentType() throws MessagingException { notImplemented(); return null; } public boolean isMimeType(String s) throws MessagingException { notImplemented(); return false; } public String getDisposition() throws MessagingException { notImplemented(); return null; } public void setDisposition(String s) throws MessagingException { notImplemented(); } public String getDescription() throws MessagingException { notImplemented(); return null; } public void setDescription(String s) throws MessagingException { notImplemented(); } public String getFileName() throws MessagingException { notImplemented(); return null; } public void setFileName(String s) throws MessagingException { notImplemented(); } public InputStream getInputStream() throws IOException, MessagingException { notImplemented(); return null; } public DataHandler getDataHandler() throws MessagingException { notImplemented(); return null; } public Object getContent() throws IOException, MessagingException { notImplemented(); return null; } public void setDataHandler(DataHandler handler) throws MessagingException { notImplemented(); } public void setExpectedContent(Object aContent, String aMimeType){ myContent.setExpected(aContent); myMimeType.setExpected(aMimeType); } public void setContent(Object aContent, String aMimeType) throws MessagingException { myContent.setActual(aContent); myMimeType.setActual(aMimeType); } public void setExpectedText(String aText){ myText.setExpected(aText); } public void setText(String aText) throws MessagingException { myText.setActual(aText); } public void setContent(Multipart multipart) throws MessagingException { notImplemented(); } public void writeTo(OutputStream stream) throws IOException, MessagingException { notImplemented(); } public javax.mail.Message getRealMessage() { return null; } public String[] getHeader(String s) throws MessagingException { notImplemented(); return new String[0]; } public void setHeader(String s, String s1) throws MessagingException { notImplemented(); } public void addHeader(String s, String s1) throws MessagingException { notImplemented(); } public void removeHeader(String s) throws MessagingException { notImplemented(); } public Enumeration getAllHeaders() throws MessagingException { notImplemented(); return null; } public Enumeration getMatchingHeaders(String[] strings) throws MessagingException { notImplemented(); return null; } public Enumeration getNonMatchingHeaders(String[] strings) throws MessagingException { notImplemented(); return null; } } Index: MockTransport.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/com/mockobjects/mail/MockTransport.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MockTransport.java 30 Apr 2002 17:03:10 -0000 1.1 +++ MockTransport.java 19 Jun 2002 15:26:21 -0000 1.2 @@ -1,7 +1,7 @@ package com.mockobjects.mail; import javax.mail.event.TransportListener; -import javax.mail.Message; +import alt.javax.mail.Message; import javax.mail.Address; import com.mockobjects.*; import alt.javax.mail.Transport; |
From: Jeff M. <cus...@us...> - 2002-06-19 15:26:55
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/alt/javax/mail/internet In directory usw-pr-cvs1:/tmp/cvs-serv12913/src/j2ee/common/alt/javax/mail/internet Modified Files: MimeMessageFactory.java MimeMessageFactoryImpl.java Added Files: MimeMessage.java MimeMessageImpl.java Log Message: Lots of small changes to mocks --- NEW FILE: MimeMessage.java --- package alt.javax.mail.internet; import alt.javax.mail.Message; import javax.mail.Address; import javax.mail.MessagingException; import javax.mail.Flags; import javax.mail.Folder; import javax.mail.search.SearchTerm; import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; import java.util.Enumeration; public interface MimeMessage extends Message { void setRecipient(javax.mail.Message.RecipientType type, Address address) throws MessagingException; void addRecipient(javax.mail.Message.RecipientType type, Address address) throws MessagingException; void setFlag(Flags.Flag flag, boolean b) throws MessagingException; int getMessageNumber(); Folder getFolder(); boolean isExpunged(); boolean match(SearchTerm term) throws MessagingException; Address[] getAllRecipients() throws MessagingException; void setRecipients(javax.mail.Message.RecipientType type, String s) throws MessagingException; void addRecipients(javax.mail.Message.RecipientType type, String s) throws MessagingException; Address[] getReplyTo() throws MessagingException; void setReplyTo(Address[] addresses) throws MessagingException; void setSubject(String s, String s1) throws MessagingException; String getEncoding() throws MessagingException; String getContentID() throws MessagingException; void setContentID(String s) throws MessagingException; String getContentMD5() throws MessagingException; void setContentMD5(String s) throws MessagingException; void setDescription(String s, String s1) throws MessagingException; String[] getContentLanguage() throws MessagingException; void setContentLanguage(String[] strings) throws MessagingException; String getMessageID() throws MessagingException; InputStream getRawInputStream() throws MessagingException; void setText(String s, String s1) throws MessagingException; void writeTo(OutputStream stream, String[] strings) throws IOException, MessagingException; String getHeader(String s, String s1) throws MessagingException; void addHeaderLine(String s) throws MessagingException; Enumeration getAllHeaderLines() throws MessagingException; Enumeration getMatchingHeaderLines(String[] strings) throws MessagingException; Enumeration getNonMatchingHeaderLines(String[] strings) throws MessagingException; boolean isSet(Flags.Flag flag) throws MessagingException; } --- NEW FILE: MimeMessageImpl.java --- package alt.javax.mail.internet; import alt.javax.mail.Message; import alt.javax.mail.MessageImpl; import alt.javax.mail.Session; import javax.mail.Address; import javax.mail.Flags; import javax.mail.Folder; import javax.mail.MessagingException; import javax.mail.search.SearchTerm; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Enumeration; public class MimeMessageImpl extends MessageImpl implements MimeMessage { private final javax.mail.internet.MimeMessage message; public MimeMessageImpl(Session session) { super(new javax.mail.internet.MimeMessage(session.getWrappedSession())); message = (javax.mail.internet.MimeMessage)getRealMessage(); } public void setRecipient(javax.mail.Message.RecipientType type, Address address) throws MessagingException { message.setRecipient(type, address); } public void addRecipient(javax.mail.Message.RecipientType type, Address address) throws MessagingException { message.addRecipient(type, address); } public void setFlag(Flags.Flag flag, boolean b) throws MessagingException { message.setFlag(flag, b); } public int getMessageNumber() { return message.getMessageNumber(); } public Folder getFolder() { return message.getFolder(); } public boolean isExpunged() { return message.isExpunged(); } public boolean match(SearchTerm term) throws MessagingException { return message.match(term); } public Address[] getAllRecipients() throws MessagingException { return message.getAllRecipients(); } public void setRecipients(javax.mail.Message.RecipientType type, String s) throws MessagingException { message.setRecipients(type, s); } public void addRecipients(javax.mail.Message.RecipientType type, String s) throws MessagingException { message.addRecipients(type, s); } public Address[] getReplyTo() throws MessagingException { return message.getReplyTo(); } public void setReplyTo(Address[] addresses) throws MessagingException { message.setReplyTo(addresses); } public void setSubject(String s, String s1) throws MessagingException { message.setSubject(s, s1); } public String getEncoding() throws MessagingException { return message.getEncoding(); } public String getContentID() throws MessagingException { return message.getContentID(); } public void setContentID(String s) throws MessagingException { message.setContentID(s); } public String getContentMD5() throws MessagingException { return message.getContentMD5(); } public void setContentMD5(String s) throws MessagingException { message.setContentMD5(s); } public void setDescription(String s, String s1) throws MessagingException { message.setDescription(s, s1); } public String[] getContentLanguage() throws MessagingException { return message.getContentLanguage(); } public void setContentLanguage(String[] strings) throws MessagingException { message.setContentLanguage(strings); } public String getMessageID() throws MessagingException { return message.getMessageID(); } public InputStream getRawInputStream() throws MessagingException { return message.getRawInputStream(); } public void setText(String s, String s1) throws MessagingException { message.setText(s, s1); } public void writeTo(OutputStream stream, String[] strings) throws IOException, MessagingException { message.writeTo(stream, strings); } public String getHeader(String s, String s1) throws MessagingException { return message.getHeader(s, s1); } public void addHeaderLine(String s) throws MessagingException { message.addHeaderLine(s); } public Enumeration getAllHeaderLines() throws MessagingException { return message.getAllHeaderLines(); } public Enumeration getMatchingHeaderLines(String[] strings) throws MessagingException { return message.getMatchingHeaderLines(strings); } public Enumeration getNonMatchingHeaderLines(String[] strings) throws MessagingException { return message.getNonMatchingHeaderLines(strings); } public synchronized boolean isSet(Flags.Flag flag) throws MessagingException { return message.isSet(flag); } } Index: MimeMessageFactory.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/alt/javax/mail/internet/MimeMessageFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MimeMessageFactory.java 30 Apr 2002 17:03:10 -0000 1.1 +++ MimeMessageFactory.java 19 Jun 2002 15:26:21 -0000 1.2 @@ -1,6 +1,6 @@ package alt.javax.mail.internet; -import javax.mail.internet.MimeMessage; +import alt.javax.mail.internet.MimeMessage; import alt.javax.mail.Session; public interface MimeMessageFactory { Index: MimeMessageFactoryImpl.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/alt/javax/mail/internet/MimeMessageFactoryImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MimeMessageFactoryImpl.java 30 Apr 2002 17:03:10 -0000 1.1 +++ MimeMessageFactoryImpl.java 19 Jun 2002 15:26:21 -0000 1.2 @@ -1,10 +1,10 @@ package alt.javax.mail.internet; -import javax.mail.internet.MimeMessage; +import alt.javax.mail.internet.MimeMessage; import alt.javax.mail.Session; public class MimeMessageFactoryImpl implements MimeMessageFactory { public MimeMessage createMimeMessage(Session session){ - return new MimeMessage(session.getWrappedSession()); + return new MimeMessageImpl(session); } } |