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: Scott L. <sl...@sl...> - 2002-12-20 08:02:18
|
Ewald Arnold wrote: > - a "synchronized" method is a threadsafe method and provides some form of > mutual exclusion? Yes. Every Object (and everything derives from object) has a built-in mutex. "synchronized" methods and blocks acquire the mutex on entry and release it on exit. > - Verfier.java contains some parameters of type "Field". What does this mean > and how could one solve this with c++? Hmm, that's using the Java introspection API. C++ doesn't have anything like that. I don't think a verifier for an arbitrary class is possible. You'll need to make each class call verify for each of its verifiable members. Maybe verifiable could take a parameter of a collection to add itself to so this is easier. Scott |
From: Ewald A. <mo...@ew...> - 2002-12-20 04:50:21
|
Hello, nice to get some feedback :-) > Any chance you could put the code into cvs somewhere even if it doesn't I want to convert at least the core files. So I think I will upload this weekend for the first time :-) but it certainly not compile.. There are some java related questions: - a "synchronized" method is a threadsafe method and provides some form of mutual exclusion? - Verfier.java contains some parameters of type "Field". What does this mean and how could one solve this with c++? I guess there will be more when I really start to make it work. cheers Ewald -- Ewald Arnold, Germany mailto:ewald at ewald-arnold dot de mobil/sms:+49-162-8001240 |
From: <je...@mk...> - 2002-12-19 09:32:39
|
Cool, I'll try and get an announcement up on www.mockobjects.com sometime next week. Any chance you could put the code into cvs somewhere even if it doesn't work yet it'd be nice to see where your going with it. Though I must admit that C++ isn't my strong point but it might give me a few insights into how things work. Quoting Ewald Arnold <ew...@ew...>: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hello all, > > I just wanted to let you know, that I have started creating a framework for > > c++ very similar to your mock object implementation. > > To be honest, currently it is rather a copy of your latest package which I am > > converting to c++ as good as possible, since I want to have the same > interfaces to be compatible and make life easier for users using both java > and c++. > > The homepage is at http://mockpp.sf.net but due to my early stage there is > currently nothing for download yet. > > Unfortunatley I am not very familiar with java but I hope to get some > information here if I get stuck :-) > > cheers > Ewald > > - -- > Ewald Arnold, Germany > mailto:ewald at ewald-arnold dot de > mobil/sms:+49-162-8001240 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.0.7 (GNU/Linux) > > iD8DBQE+ANtnXyQcrD0ZXUYRAt9QAJsG65P5Zs22UFO0qkKB+FHUgXpiewCfQfvZ > hJQksNIsEKMoDWwU21WS9i0= > =fdlO > -----END PGP SIGNATURE----- > > > > ------------------------------------------------------- > This SF.NET email is sponsored by: Order your Holiday Geek Presents Now! > Green Lasers, Hip Geek T-Shirts, Remote Control Tanks, Caffeinated Soap, > MP3 Players, XBox Games, Flying Saucers, WebCams, Smart Putty. > T H I N K G E E K . C O M http://www.thinkgeek.com/sf/ > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > |
From: Ewald A. <ew...@ew...> - 2002-12-18 20:32:52
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello all, I just wanted to let you know, that I have started creating a framework for c++ very similar to your mock object implementation. To be honest, currently it is rather a copy of your latest package which I am converting to c++ as good as possible, since I want to have the same interfaces to be compatible and make life easier for users using both java and c++. The homepage is at http://mockpp.sf.net but due to my early stage there is currently nothing for download yet. Unfortunatley I am not very familiar with java but I hope to get some information here if I get stuck :-) cheers Ewald - -- Ewald Arnold, Germany mailto:ewald at ewald-arnold dot de mobil/sms:+49-162-8001240 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE+ANtnXyQcrD0ZXUYRAt9QAJsG65P5Zs22UFO0qkKB+FHUgXpiewCfQfvZ hJQksNIsEKMoDWwU21WS9i0= =fdlO -----END PGP SIGNATURE----- |
From: <je...@mk...> - 2002-12-18 10:30:35
|
That'd be because no one has needed them. Either people don't use CallableStatements much or just don't bother testing them ;) Feel free to implement which ever methods you need and we'll add them to the source. Quoting Griffin Caprio <gri...@ho...>: > ok, here is a real question: > > Is there some compelling reason why CallableStatements aren't implemented > yet? > > Griffin > > > > _________________________________________________________________ > STOP MORE SPAM with the new MSN 8 and get 2 months FREE* > http://join.msn.com/?page=features/junkmail > > > > ------------------------------------------------------- > This sf.net email is sponsored by: > With Great Power, Comes Great Responsibility > Learn to use your power at OSDN's High Performance Computing Channel > http://hpc.devchannel.org/ > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > |
From: <je...@mk...> - 2002-12-18 10:26:41
|
This would fit with the ReturnObjectList (return the next object in a list) and the ReturnObjectBag (same as ReturnObjectList except with a map of lists). This did go through my head when vincent mentioned it, but it'd be quite a bit of work to go through every object replacing return values with a ReturnValue object. private final ReturnValue value = new ReturnValue("value"); public void setupValue(Integer value){ value.setValue(value); } public Integer getValue(){ return (Integer)value.getValue(); } or you could have a map in MockObject to give you this public void setupValue(Integer value){ setMockValue("value", value); } public Integer getValue(){ return (Integer)getMockValue("value"); } thought you then need to think about scoping you might be able to sort that by maping agains object and key. Just thinking out loud really. Quoting Tim Mackinnon <tim...@po...>: > Yes - that would be a good improvement - I think Ivan's mockmaker > implementation does this with its ReturnValues object and the not enough > values exception... we should roll this into a unified implementation (the > flaw in the mockmaker stuff is that it doesn't tell you the name of the > object that didn't have enough values (like expection list and set do) so > its a bit mysterious. > > Tim > > -----Original Message----- > From: moc...@li... > [mailto:moc...@li...]On Behalf Of > Vincent Massol > Sent: 17 December 2002 11:09 > To: 'MockObjects' > Subject: [MO-java-dev] Important "bug" in the library > > > Hi, > > I believe there is a common "bug" that can be found in several of our > mocks objects. > > Here's an example, from MockResultSet.java (line 281): > > public ResultSetMetaData getMetaData() throws SQLException { > return myMetaData; > } > > If no setup has been done, it will return null. That's the problem. > Imagine the following piece of code (that is part of a third party > library): > > 1 protected void introspect() throws SQLException { > 2 > 3 // Accumulate an ordered list of DynaProperties > 4 ArrayList list = new ArrayList(); > 5 ResultSetMetaData metadata = resultSet.getMetaData(); > 6 int n = metadata.getColumnCount(); > [...] > > If I have some of my code that class under test that calls introspect() > and if I haven't set up the behaviour for getMetaData(), I will get a > NPE. > > I was very lucky here as I was able to obtain the source code for this > third party library and thus I could find out that the problem was that > getMetaData was called. But we might not get that lucky every time! > > I believe the correct implementation should check if myMetaData has been > set or not and if not, throw an exception stating it. > > What do you think? > > Thanks > -Vincent > > > > ------------------------------------------------------- > This sf.net email is sponsored by: > With Great Power, Comes Great Responsibility > Learn to use your power at OSDN's High Performance Computing Channel > http://hpc.devchannel.org/ > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.427 / Virus Database: 240 - Release Date: 06/12/2002 > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.427 / Virus Database: 240 - Release Date: 06/12/2002 > > > > ------------------------------------------------------- > This sf.net email is sponsored by: > With Great Power, Comes Great Responsibility > Learn to use your power at OSDN's High Performance Computing Channel > http://hpc.devchannel.org/ > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > |
From: Patrick L. <pli...@ci...> - 2002-12-18 09:09:47
|
Could something like this be added as a standard MockCall as well as a method in the Mock object. -Pat ----- Original Message ----- From: "Nat Pryce" <nat...@b1...> To: "Patrick Lightbody" <pli...@ci...>; <moc...@li...> Sent: Wednesday, December 18, 2002 12:29 AM Subject: Re: [MO-java-dev] Using same method name, different args > That's a much better solution than mine. I thought of the same thing this > morning and was going to post a message suggesting it, but you beat me to > it. How could I forget that I originally refactored out the the MockCall > interface for this very purpose? Doh! > > Cheers, > Nat. > > ________________________________ > Dr. Nathaniel Pryce > B13media Ltd. > Studio 3a, Aberdeen Business Centre, 22/24 Highbury Grove, London, N5 2EA > http://www.b13media.com > > ----- Original Message ----- > From: "Patrick Lightbody" <pli...@ci...> > To: "Nat Pryce" <nat...@b1...>; > <moc...@li...> > Sent: Wednesday, December 18, 2002 2:20 AM > Subject: Re: [MO-java-dev] Using same method name, different args > > > > I resolved this by creating a new MockCall called ArgMockReturnCall: > > > > [snip] > > public Object call(Object[] args) throws Throwable { > > int argCount = (args == null) ? 0 : args.length; > > > > for (Iterator iterator = argMappings.entrySet().iterator(); > > iterator.hasNext();) { > > Map.Entry entry = (Map.Entry) iterator.next(); > > Constraint[] constraints = (Constraint[]) entry.getKey(); > > Object value = entry.getValue(); > > > > assertEquals("wrong number of arguments", argCount, > > constraints.length); > > > > if (validArguments(args, constraints)) { > > return value; > > } > > } > > > > return defaultValue; > > } > > [snip] > > > > An example of using it is as follows: > > > > // mock finding other GVs > > ArgMockReturnCall mockCall = new ArgMockReturnCal(Collections.EMPTY_LIST); > > mockCall.addMapping(C.args(C.eq(DocumentProblemType.ENTITY_NAME), > > C.IS_ANYTHING), UtilMisc.toList(dpt1, dpt2)); > > m.setup("findByAndCache", mockCall); > > > > So what this does is say: "if findByAndCache is called using the first > > argument as DocumentProblemType.ENTITY_NAME then return a special List. > > Otherwise fall back to returning an empty list. > > > > I think this MockCall would be very useful to a lot of people. Lots of > code > > people have runs against services (such as Ofbiz) that use the same method > > name with different args and expect different values returned. > > > > -Pat > > > > > > ----- Original Message ----- > > From: "Nat Pryce" <nat...@b1...> > > To: "Patrick Lightbody" <pli...@ci...>; > > <moc...@li...> > > Sent: Tuesday, December 17, 2002 5:53 PM > > Subject: Re: [MO-java-dev] Using same method name, different args > > > > > > > The way round this problem is to extend the Mock class and implement > > special > > > behaviour for the methods that you want to be mocked differently -- > > > findByAndCache in your example. If you define findByAndCache in the a > > class > > > derived from Mock with the same argument types as defined in the mocked > > > interface, the Mock class will call that implementation in preference to > > its > > > default mock implementation. You can invoke the default implementation > by > > > calling the mockCall method if you want to within findByAndCache. > > > > > > E.g. > > > > > > class MockCachedFinder extends Mock { > > > public MockCachedFinder() { > > > super( CachedFinder.class ); > > > } > > > > > > List findByAndCache( String name, ... other args ... ) { > > > ... implement special mock behaviour in here > > > } > > > } > > > > > > > > > In my experience, however, I have often found that having to put logic > > into > > > a mock object is an indication that there is something wrong with my > > design. > > > Perhaps you are testing too much in one go, and each interaction should > > > instead be tested in an individual test case. Perhaps your method does > > too > > > much, and should instead be split into methods with different names that > > can > > > each be mocked individually. I can't suggest more than that from the > > little > > > I have seen, but I have often found that following the "Tao of the Mock > > > Object" leads me to cleaner designs. > > > > > > Cheers, > > > Nat. > > > ________________________________ > > > Dr. Nathaniel Pryce > > > B13media Ltd. > > > Studio 3a, Aberdeen Business Centre, 22/24 Highbury Grove, London, N5 > 2EA > > > http://www.b13media.com > > > > > > > > > ----- Original Message ----- > > > From: "Patrick Lightbody" <pli...@ci...> > > > To: <moc...@li...> > > > Sent: Tuesday, December 17, 2002 7:05 PM > > > Subject: [MO-java-dev] Using same method name, different args > > > > > > > > > > I really like the dynamic mock stuff, but it seems there is a pretty > > major > > > > flaw: MockExceptedCalls are mapped using _only_ the methodName. That > > means > > > I > > > > can't expect multiple values for different args on the same method: > > > > > > > > m.expectAndReturn("findByAndCache", > > > > C.args(C.eq(DocumentProblemType.ENTITY_NAME), > > > > C.IS_ANYTHING), > > > > UtilMisc.toList(dpt1, dpt2)); > > > > m.expectAndReturn("findByAndCache", > > > > C.args(C.eq(DocumentSubject.ENTITY_NAME), > > C.IS_ANYTHING), > > > > Collections.EMPTY_LIST); > > > > m.expectAndReturn("findByAndCache", > > > > C.args(C.eq(Publishaction.ENTITY_NAME), > C.IS_ANYTHING), > > > > Collections.EMPTY_LIST); > > > > m.expectAndReturn("findByAndCache", > > > > C.args(C.eq(Reviewaction.ENTITY_NAME), C.IS_ANYTHING), > > > > Collections.EMPTY_LIST); > > > > > > > > This code doesn't work becuase the most recent expectation overrides > the > > > > previous one, and my code ends up failing. Am I using the Mock object > > > > incorrectly, or is there a way around this? > > > > > > > > -Pat > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > This sf.net email is sponsored by: > > > > With Great Power, Comes Great Responsibility > > > > Learn to use your power at OSDN's High Performance Computing Channel > > > > http://hpc.devchannel.org/ > > > > _______________________________________________ > > > > Mockobjects-java-dev mailing list > > > > Moc...@li... > > > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by: > > With Great Power, Comes Great Responsibility > > Learn to use your power at OSDN's High Performance Computing Channel > > http://hpc.devchannel.org/ > > _______________________________________________ > > Mockobjects-java-dev mailing list > > Moc...@li... > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |
From: Nat P. <nat...@b1...> - 2002-12-18 08:50:38
|
That's a much better solution than mine. I thought of the same thing this morning and was going to post a message suggesting it, but you beat me to it. How could I forget that I originally refactored out the the MockCall interface for this very purpose? Doh! Cheers, Nat. ________________________________ Dr. Nathaniel Pryce B13media Ltd. Studio 3a, Aberdeen Business Centre, 22/24 Highbury Grove, London, N5 2EA http://www.b13media.com ----- Original Message ----- From: "Patrick Lightbody" <pli...@ci...> To: "Nat Pryce" <nat...@b1...>; <moc...@li...> Sent: Wednesday, December 18, 2002 2:20 AM Subject: Re: [MO-java-dev] Using same method name, different args > I resolved this by creating a new MockCall called ArgMockReturnCall: > > [snip] > public Object call(Object[] args) throws Throwable { > int argCount = (args == null) ? 0 : args.length; > > for (Iterator iterator = argMappings.entrySet().iterator(); > iterator.hasNext();) { > Map.Entry entry = (Map.Entry) iterator.next(); > Constraint[] constraints = (Constraint[]) entry.getKey(); > Object value = entry.getValue(); > > assertEquals("wrong number of arguments", argCount, > constraints.length); > > if (validArguments(args, constraints)) { > return value; > } > } > > return defaultValue; > } > [snip] > > An example of using it is as follows: > > // mock finding other GVs > ArgMockReturnCall mockCall = new ArgMockReturnCal(Collections.EMPTY_LIST); > mockCall.addMapping(C.args(C.eq(DocumentProblemType.ENTITY_NAME), > C.IS_ANYTHING), UtilMisc.toList(dpt1, dpt2)); > m.setup("findByAndCache", mockCall); > > So what this does is say: "if findByAndCache is called using the first > argument as DocumentProblemType.ENTITY_NAME then return a special List. > Otherwise fall back to returning an empty list. > > I think this MockCall would be very useful to a lot of people. Lots of code > people have runs against services (such as Ofbiz) that use the same method > name with different args and expect different values returned. > > -Pat > > > ----- Original Message ----- > From: "Nat Pryce" <nat...@b1...> > To: "Patrick Lightbody" <pli...@ci...>; > <moc...@li...> > Sent: Tuesday, December 17, 2002 5:53 PM > Subject: Re: [MO-java-dev] Using same method name, different args > > > > The way round this problem is to extend the Mock class and implement > special > > behaviour for the methods that you want to be mocked differently -- > > findByAndCache in your example. If you define findByAndCache in the a > class > > derived from Mock with the same argument types as defined in the mocked > > interface, the Mock class will call that implementation in preference to > its > > default mock implementation. You can invoke the default implementation by > > calling the mockCall method if you want to within findByAndCache. > > > > E.g. > > > > class MockCachedFinder extends Mock { > > public MockCachedFinder() { > > super( CachedFinder.class ); > > } > > > > List findByAndCache( String name, ... other args ... ) { > > ... implement special mock behaviour in here > > } > > } > > > > > > In my experience, however, I have often found that having to put logic > into > > a mock object is an indication that there is something wrong with my > design. > > Perhaps you are testing too much in one go, and each interaction should > > instead be tested in an individual test case. Perhaps your method does > too > > much, and should instead be split into methods with different names that > can > > each be mocked individually. I can't suggest more than that from the > little > > I have seen, but I have often found that following the "Tao of the Mock > > Object" leads me to cleaner designs. > > > > Cheers, > > Nat. > > ________________________________ > > Dr. Nathaniel Pryce > > B13media Ltd. > > Studio 3a, Aberdeen Business Centre, 22/24 Highbury Grove, London, N5 2EA > > http://www.b13media.com > > > > > > ----- Original Message ----- > > From: "Patrick Lightbody" <pli...@ci...> > > To: <moc...@li...> > > Sent: Tuesday, December 17, 2002 7:05 PM > > Subject: [MO-java-dev] Using same method name, different args > > > > > > > I really like the dynamic mock stuff, but it seems there is a pretty > major > > > flaw: MockExceptedCalls are mapped using _only_ the methodName. That > means > > I > > > can't expect multiple values for different args on the same method: > > > > > > m.expectAndReturn("findByAndCache", > > > C.args(C.eq(DocumentProblemType.ENTITY_NAME), > > > C.IS_ANYTHING), > > > UtilMisc.toList(dpt1, dpt2)); > > > m.expectAndReturn("findByAndCache", > > > C.args(C.eq(DocumentSubject.ENTITY_NAME), > C.IS_ANYTHING), > > > Collections.EMPTY_LIST); > > > m.expectAndReturn("findByAndCache", > > > C.args(C.eq(Publishaction.ENTITY_NAME), C.IS_ANYTHING), > > > Collections.EMPTY_LIST); > > > m.expectAndReturn("findByAndCache", > > > C.args(C.eq(Reviewaction.ENTITY_NAME), C.IS_ANYTHING), > > > Collections.EMPTY_LIST); > > > > > > This code doesn't work becuase the most recent expectation overrides the > > > previous one, and my code ends up failing. Am I using the Mock object > > > incorrectly, or is there a way around this? > > > > > > -Pat > > > > > > > > > > > > ------------------------------------------------------- > > > This sf.net email is sponsored by: > > > With Great Power, Comes Great Responsibility > > > Learn to use your power at OSDN's High Performance Computing Channel > > > http://hpc.devchannel.org/ > > > _______________________________________________ > > > Mockobjects-java-dev mailing list > > > Moc...@li... > > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev > > > > ------------------------------------------------------- > This sf.net email is sponsored by: > With Great Power, Comes Great Responsibility > Learn to use your power at OSDN's High Performance Computing Channel > http://hpc.devchannel.org/ > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |
From: Patrick L. <pli...@ci...> - 2002-12-18 02:21:59
|
I resolved this by creating a new MockCall called ArgMockReturnCall: [snip] public Object call(Object[] args) throws Throwable { int argCount = (args == null) ? 0 : args.length; for (Iterator iterator = argMappings.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); Constraint[] constraints = (Constraint[]) entry.getKey(); Object value = entry.getValue(); assertEquals("wrong number of arguments", argCount, constraints.length); if (validArguments(args, constraints)) { return value; } } return defaultValue; } [snip] An example of using it is as follows: // mock finding other GVs ArgMockReturnCall mockCall = new ArgMockReturnCal(Collections.EMPTY_LIST); mockCall.addMapping(C.args(C.eq(DocumentProblemType.ENTITY_NAME), C.IS_ANYTHING), UtilMisc.toList(dpt1, dpt2)); m.setup("findByAndCache", mockCall); So what this does is say: "if findByAndCache is called using the first argument as DocumentProblemType.ENTITY_NAME then return a special List. Otherwise fall back to returning an empty list. I think this MockCall would be very useful to a lot of people. Lots of code people have runs against services (such as Ofbiz) that use the same method name with different args and expect different values returned. -Pat ----- Original Message ----- From: "Nat Pryce" <nat...@b1...> To: "Patrick Lightbody" <pli...@ci...>; <moc...@li...> Sent: Tuesday, December 17, 2002 5:53 PM Subject: Re: [MO-java-dev] Using same method name, different args > The way round this problem is to extend the Mock class and implement special > behaviour for the methods that you want to be mocked differently -- > findByAndCache in your example. If you define findByAndCache in the a class > derived from Mock with the same argument types as defined in the mocked > interface, the Mock class will call that implementation in preference to its > default mock implementation. You can invoke the default implementation by > calling the mockCall method if you want to within findByAndCache. > > E.g. > > class MockCachedFinder extends Mock { > public MockCachedFinder() { > super( CachedFinder.class ); > } > > List findByAndCache( String name, ... other args ... ) { > ... implement special mock behaviour in here > } > } > > > In my experience, however, I have often found that having to put logic into > a mock object is an indication that there is something wrong with my design. > Perhaps you are testing too much in one go, and each interaction should > instead be tested in an individual test case. Perhaps your method does too > much, and should instead be split into methods with different names that can > each be mocked individually. I can't suggest more than that from the little > I have seen, but I have often found that following the "Tao of the Mock > Object" leads me to cleaner designs. > > Cheers, > Nat. > ________________________________ > Dr. Nathaniel Pryce > B13media Ltd. > Studio 3a, Aberdeen Business Centre, 22/24 Highbury Grove, London, N5 2EA > http://www.b13media.com > > > ----- Original Message ----- > From: "Patrick Lightbody" <pli...@ci...> > To: <moc...@li...> > Sent: Tuesday, December 17, 2002 7:05 PM > Subject: [MO-java-dev] Using same method name, different args > > > > I really like the dynamic mock stuff, but it seems there is a pretty major > > flaw: MockExceptedCalls are mapped using _only_ the methodName. That means > I > > can't expect multiple values for different args on the same method: > > > > m.expectAndReturn("findByAndCache", > > C.args(C.eq(DocumentProblemType.ENTITY_NAME), > > C.IS_ANYTHING), > > UtilMisc.toList(dpt1, dpt2)); > > m.expectAndReturn("findByAndCache", > > C.args(C.eq(DocumentSubject.ENTITY_NAME), C.IS_ANYTHING), > > Collections.EMPTY_LIST); > > m.expectAndReturn("findByAndCache", > > C.args(C.eq(Publishaction.ENTITY_NAME), C.IS_ANYTHING), > > Collections.EMPTY_LIST); > > m.expectAndReturn("findByAndCache", > > C.args(C.eq(Reviewaction.ENTITY_NAME), C.IS_ANYTHING), > > Collections.EMPTY_LIST); > > > > This code doesn't work becuase the most recent expectation overrides the > > previous one, and my code ends up failing. Am I using the Mock object > > incorrectly, or is there a way around this? > > > > -Pat > > > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by: > > With Great Power, Comes Great Responsibility > > Learn to use your power at OSDN's High Performance Computing Channel > > http://hpc.devchannel.org/ > > _______________________________________________ > > Mockobjects-java-dev mailing list > > Moc...@li... > > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |
From: Nat P. <nat...@b1...> - 2002-12-18 02:15:27
|
The way round this problem is to extend the Mock class and implement special behaviour for the methods that you want to be mocked differently -- findByAndCache in your example. If you define findByAndCache in the a class derived from Mock with the same argument types as defined in the mocked interface, the Mock class will call that implementation in preference to its default mock implementation. You can invoke the default implementation by calling the mockCall method if you want to within findByAndCache. E.g. class MockCachedFinder extends Mock { public MockCachedFinder() { super( CachedFinder.class ); } List findByAndCache( String name, ... other args ... ) { ... implement special mock behaviour in here } } In my experience, however, I have often found that having to put logic into a mock object is an indication that there is something wrong with my design. Perhaps you are testing too much in one go, and each interaction should instead be tested in an individual test case. Perhaps your method does too much, and should instead be split into methods with different names that can each be mocked individually. I can't suggest more than that from the little I have seen, but I have often found that following the "Tao of the Mock Object" leads me to cleaner designs. Cheers, Nat. ________________________________ Dr. Nathaniel Pryce B13media Ltd. Studio 3a, Aberdeen Business Centre, 22/24 Highbury Grove, London, N5 2EA http://www.b13media.com ----- Original Message ----- From: "Patrick Lightbody" <pli...@ci...> To: <moc...@li...> Sent: Tuesday, December 17, 2002 7:05 PM Subject: [MO-java-dev] Using same method name, different args > I really like the dynamic mock stuff, but it seems there is a pretty major > flaw: MockExceptedCalls are mapped using _only_ the methodName. That means I > can't expect multiple values for different args on the same method: > > m.expectAndReturn("findByAndCache", > C.args(C.eq(DocumentProblemType.ENTITY_NAME), > C.IS_ANYTHING), > UtilMisc.toList(dpt1, dpt2)); > m.expectAndReturn("findByAndCache", > C.args(C.eq(DocumentSubject.ENTITY_NAME), C.IS_ANYTHING), > Collections.EMPTY_LIST); > m.expectAndReturn("findByAndCache", > C.args(C.eq(Publishaction.ENTITY_NAME), C.IS_ANYTHING), > Collections.EMPTY_LIST); > m.expectAndReturn("findByAndCache", > C.args(C.eq(Reviewaction.ENTITY_NAME), C.IS_ANYTHING), > Collections.EMPTY_LIST); > > This code doesn't work becuase the most recent expectation overrides the > previous one, and my code ends up failing. Am I using the Mock object > incorrectly, or is there a way around this? > > -Pat > > > > ------------------------------------------------------- > This sf.net email is sponsored by: > With Great Power, Comes Great Responsibility > Learn to use your power at OSDN's High Performance Computing Channel > http://hpc.devchannel.org/ > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev |
From: Tim M. <tim...@po...> - 2002-12-18 00:27:12
|
Yes - that would be a good improvement - I think Ivan's mockmaker implementation does this with its ReturnValues object and the not enough values exception... we should roll this into a unified implementation (the flaw in the mockmaker stuff is that it doesn't tell you the name of the object that didn't have enough values (like expection list and set do) so its a bit mysterious. Tim -----Original Message----- From: moc...@li... [mailto:moc...@li...]On Behalf Of Vincent Massol Sent: 17 December 2002 11:09 To: 'MockObjects' Subject: [MO-java-dev] Important "bug" in the library Hi, I believe there is a common "bug" that can be found in several of our mocks objects. Here's an example, from MockResultSet.java (line 281): public ResultSetMetaData getMetaData() throws SQLException { return myMetaData; } If no setup has been done, it will return null. That's the problem. Imagine the following piece of code (that is part of a third party library): 1 protected void introspect() throws SQLException { 2 3 // Accumulate an ordered list of DynaProperties 4 ArrayList list = new ArrayList(); 5 ResultSetMetaData metadata = resultSet.getMetaData(); 6 int n = metadata.getColumnCount(); [...] If I have some of my code that class under test that calls introspect() and if I haven't set up the behaviour for getMetaData(), I will get a NPE. I was very lucky here as I was able to obtain the source code for this third party library and thus I could find out that the problem was that getMetaData was called. But we might not get that lucky every time! I believe the correct implementation should check if myMetaData has been set or not and if not, throw an exception stating it. What do you think? Thanks -Vincent ------------------------------------------------------- This sf.net email is sponsored by: With Great Power, Comes Great Responsibility Learn to use your power at OSDN's High Performance Computing Channel http://hpc.devchannel.org/ _______________________________________________ Mockobjects-java-dev mailing list Moc...@li... https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.427 / Virus Database: 240 - Release Date: 06/12/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.427 / Virus Database: 240 - Release Date: 06/12/2002 |
From: Griffin C. <gri...@ho...> - 2002-12-17 23:16:12
|
Please ignore my earlier question about MockConnection. I was looking in the wrong place.... Hey, it's late in the day.... Griffin _________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail |
From: Griffin C. <gri...@ho...> - 2002-12-17 22:59:48
|
ok, here is a real question: Is there some compelling reason why CallableStatements aren't implemented yet? Griffin _________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail |
From: Griffin C. <gri...@ho...> - 2002-12-17 22:45:22
|
What's the status of MockConnection? I am trying to use the setupUpdateCount function and I can't find it in MockConnection or MockConnection2. Is it somewhere else? Has it been replaced by something else? Thanks, Griffin _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail |
From: Patrick L. <pli...@ci...> - 2002-12-17 19:07:26
|
I really like the dynamic mock stuff, but it seems there is a pretty major flaw: MockExceptedCalls are mapped using _only_ the methodName. That means I can't expect multiple values for different args on the same method: m.expectAndReturn("findByAndCache", C.args(C.eq(DocumentProblemType.ENTITY_NAME), C.IS_ANYTHING), UtilMisc.toList(dpt1, dpt2)); m.expectAndReturn("findByAndCache", C.args(C.eq(DocumentSubject.ENTITY_NAME), C.IS_ANYTHING), Collections.EMPTY_LIST); m.expectAndReturn("findByAndCache", C.args(C.eq(Publishaction.ENTITY_NAME), C.IS_ANYTHING), Collections.EMPTY_LIST); m.expectAndReturn("findByAndCache", C.args(C.eq(Reviewaction.ENTITY_NAME), C.IS_ANYTHING), Collections.EMPTY_LIST); This code doesn't work becuase the most recent expectation overrides the previous one, and my code ends up failing. Am I using the Mock object incorrectly, or is there a way around this? -Pat |
From: Vincent M. <vm...@oc...> - 2002-12-17 11:09:21
|
Hi, I believe there is a common "bug" that can be found in several of our mocks objects. Here's an example, from MockResultSet.java (line 281): public ResultSetMetaData getMetaData() throws SQLException { return myMetaData; } If no setup has been done, it will return null. That's the problem. Imagine the following piece of code (that is part of a third party library): 1 protected void introspect() throws SQLException { 2 3 // Accumulate an ordered list of DynaProperties 4 ArrayList list = new ArrayList(); 5 ResultSetMetaData metadata = resultSet.getMetaData(); 6 int n = metadata.getColumnCount(); [...] If I have some of my code that class under test that calls introspect() and if I haven't set up the behaviour for getMetaData(), I will get a NPE. I was very lucky here as I was able to obtain the source code for this third party library and thus I could find out that the problem was that getMetaData was called. But we might not get that lucky every time! I believe the correct implementation should check if myMetaData has been set or not and if not, throw an exception stating it. What do you think? Thanks -Vincent |
From: Vincent M. <vm...@oc...> - 2002-12-16 13:56:24
|
> -----Original Message----- > From: moc...@li... > [mailto:moc...@li...] On Behalf Of > je...@mk... > Sent: 16 December 2002 09:42 > To: moc...@li... > Subject: Re: [MO-java-dev] CVS: mockobjects- > java/src/jdk/common/com/mockobjects/sql > CommonMockResultSetMetaData.java,1.2,1.3 > > We could change this to use the ReturnObjectBag. Then you can get the mock > to > respect the column index. > > Would that be better for what your testing Vincent? Maybe (but I don't know what ReturnObjectBag is - I'll have a look later). What I've submitted is enough for my tests to work but I'm open to improvements :-) Thanks -Vincent |
From: <je...@mk...> - 2002-12-16 09:42:04
|
We could change this to use the ReturnObjectBag. Then you can get the mock to respect the column index. Would that be better for what your testing Vincent? |
From: Steve F. <sm...@us...> - 2002-12-16 00:58:06
|
Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql In directory sc8-pr-cvs1:/tmp/cvs-serv16399/src/jdk/common/com/mockobjects/sql Modified Files: CommonMockResultSetMetaData.java Log Message: added support for getColumnClassName from Vincent Massol Index: CommonMockResultSetMetaData.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockResultSetMetaData.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CommonMockResultSetMetaData.java 9 Dec 2002 18:20:11 -0000 1.2 +++ CommonMockResultSetMetaData.java 16 Dec 2002 00:58:03 -0000 1.3 @@ -15,11 +15,15 @@ new ReturnObjectList("MockResultSetMetaData.columnNames"); private final ReturnObjectList myTypes = new ReturnObjectList("MockResultSetMetaData.columnTypes"); + private final ReturnObjectList myClassNames = + new ReturnObjectList("MockResultSetMetaData.columnClassNames"); private int myColumnCount; private final ExpectationList myColumnTypeIndexes = new ExpectationList("Column Type Indexes"); private final ExpectationList myColumnNameIndexes = new ExpectationList("Column Name Indexes"); + private final ExpectationList myColumnClassNameIndexes = + new ExpectationList("Column Class Name Indexes"); /** * Value to return from getColumnCount. @@ -269,11 +273,43 @@ } /** - * Calls notImplemented. Returns null. + * An array of column class names in the order they appear in the + * resultSet. + */ + public void setupAddColumnClassNames(String[] allNames) { + if (allNames != null) { + for (int i = 0; i < allNames.length; i++) { + setupAddColumnClassName(allNames[i]); + } + } + } + + /** + * The next column class name in the resultSet. + */ + public void setupAddColumnClassName(String aName) { + this.myClassNames.addObjectToReturn(aName); + } + + /** + * Returns the column class name. + * DOES NOT SUPPORT THE aColumnIndex PARAMETER. + * You must call getColumnClassName in order, first to last. + * Column class names may be added with setupAddColumnClassName. + * or setupAddColumnClassNames. * @see ResultSetMetaData#getColumnClassName(int) */ - public String getColumnClassName(int arg0) throws SQLException { - notImplemented(); - return null; + public String getColumnClassName(int aColumnIndex) throws SQLException { + myColumnClassNameIndexes.addActual(aColumnIndex); + return (String) myClassNames.nextReturnObject(); } + + /** + * Adds an expectation for a column index to be passed to getColumnClassName + * @see MockResultSetMetaData#getColumnClassName(int) + */ + public void addExpectedColumnClassNameIndex(int aColumnIndex){ + myColumnClassNameIndexes.addExpected(aColumnIndex); + } + } |
From: Steve F. <sm...@us...> - 2002-12-16 00:53:45
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic In directory sc8-pr-cvs1:/tmp/cvs-serv15558/src/core/test/mockobjects/dynamic Modified Files: CallCounterTest.java Log Message: Removed unused variable Index: CallCounterTest.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/CallCounterTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- CallCounterTest.java 24 Nov 2002 10:59:59 -0000 1.4 +++ CallCounterTest.java 16 Dec 2002 00:53:42 -0000 1.5 @@ -43,7 +43,6 @@ CallCounter counter = new CallCounter( 1, (MockCall)mock_call.proxy() ); - final Object RESULT = new Object(); mock_call.expectAndThrow( "call", C.ANY_ARGS, new ExampleException() ); try { |
From: Jeff M. <je...@mk...> - 2002-12-09 18:32:46
|
Not sure quite what happened there. But there was a whole bunch of changes didn't get included last time I checked stuff in. Good thing we have the Gump nags to remind us ;-) On Mon, 2002-12-09 at 18:20, Jeff Martin wrote: > Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql > In directory sc8-pr-cvs1:/tmp/cvs-serv27540/src/jdk/common/com/mockobjects/sql > > Modified Files: > MockResultSet.java CommonMockStatement.java > CommonMockSingleRowResultSet.java > CommonMockResultSetMetaData.java > CommonMockPreparedStatement.java > CommonMockMultiRowResultSet.java CommonMockConnection2.java > CommonMockConnection.java > Log Message: > Changes around MockConnection2 > > > Index: MockResultSet.java > =================================================================== > RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/MockResultSet.java,v > retrieving revision 1.3 > retrieving revision 1.4 > diff -u -r1.3 -r1.4 > --- MockResultSet.java 9 Sep 2002 12:13:53 -0000 1.3 > +++ MockResultSet.java 9 Dec 2002 18:20:09 -0000 1.4 > @@ -56,13 +56,10 @@ > * > */ > > -// ------------------------------------------------------------------------ 78 > - > package com.mockobjects.sql; > > import com.mockobjects.ExpectationCounter; > import com.mockobjects.MockObject; > -import junit.framework.AssertionFailedError; > > import java.io.InputStream; > import java.io.Reader; > @@ -83,20 +80,21 @@ > */ > abstract public class MockResultSet extends MockObject implements ResultSet { > > - > -// -------------------------------------------------------------------- fields > - > - private ExpectationCounter myCloseCalls = > - new ExpectationCounter("MockResultSet.close"); > - > - protected ExpectationCounter myNextCalls = > - new ExpectationCounter("MockResultSet.next"); > + private final ExpectationCounter myCloseCalls; > + protected final ExpectationCounter myNextCalls; > > private ResultSetMetaData myMetaData; > > private Statement myStatement; > > -// -------------------------------------------------------------- setExpected* > + public MockResultSet() { > + this(MockResultSet.class.getName()); > + } > + > + public MockResultSet(String name) { > + myCloseCalls =new ExpectationCounter(name+".close"); > + myNextCalls =new ExpectationCounter(name+".next"); > + } > > public void setExpectedCloseCalls(int calls) { > myCloseCalls.setExpected(calls); > > Index: CommonMockStatement.java > =================================================================== > RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockStatement.java,v > retrieving revision 1.2 > retrieving revision 1.3 > diff -u -r1.2 -r1.3 > --- CommonMockStatement.java 8 Jul 2002 18:30:37 -0000 1.2 > +++ CommonMockStatement.java 9 Dec 2002 18:20:10 -0000 1.3 > @@ -7,11 +7,14 @@ > > import java.sql.*; > > -public abstract class CommonMockStatement extends MockObject implements Statement { > - protected ExpectationCounter myCloseCalls = new ExpectationCounter("CommonMockStatement.closeCalls"); > - protected ExpectationCounter myExecuteCalls = new ExpectationCounter("CommonMockStatement.executeCalls"); > - protected ExpectationValue myQueryString = new ExpectationValue("CommonMockStatement.queryString"); > - protected ReturnObjectList myResultSets = new ReturnObjectList("result set"); > +/** > + * @version $Revision$ > + */ > +abstract class CommonMockStatement extends MockObject implements Statement { > + protected final ExpectationCounter myCloseCalls = new ExpectationCounter("CommonMockStatement.closeCalls"); > + protected final ExpectationCounter myExecuteCalls = new ExpectationCounter("CommonMockStatement.executeCalls"); > + protected final ExpectationValue myQueryString = new ExpectationValue("CommonMockStatement.queryString"); > + protected final ReturnObjectList myResultSets = new ReturnObjectList("result set"); > > private int myUpdateCount = 0; > private SQLException myExecuteException = null; > > Index: CommonMockSingleRowResultSet.java > =================================================================== > RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockSingleRowResultSet.java,v > retrieving revision 1.2 > retrieving revision 1.3 > diff -u -r1.2 -r1.3 > --- CommonMockSingleRowResultSet.java 9 Sep 2002 12:13:53 -0000 1.2 > +++ CommonMockSingleRowResultSet.java 9 Dec 2002 18:20:11 -0000 1.3 > @@ -78,8 +78,9 @@ > * set the corresponding value to be of type SQLException. > * @author Jeff Martin > * @author Ted Husted > + * @version $Revision$ > */ > -public abstract class CommonMockSingleRowResultSet extends MockResultSet { > +abstract class CommonMockSingleRowResultSet extends MockResultSet { > > // -------------------------------------------------------------------- fields > > > Index: CommonMockResultSetMetaData.java > =================================================================== > RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockResultSetMetaData.java,v > retrieving revision 1.1 > retrieving revision 1.2 > diff -u -r1.1 -r1.2 > --- CommonMockResultSetMetaData.java 30 Aug 2002 14:49:58 -0000 1.1 > +++ CommonMockResultSetMetaData.java 9 Dec 2002 18:20:11 -0000 1.2 > @@ -8,9 +8,9 @@ > import java.sql.SQLException; > > /** > - * $Revision$ > + * @version $Revision$ > */ > -public abstract class CommonMockResultSetMetaData extends MockObject implements ResultSetMetaData { > +class CommonMockResultSetMetaData extends MockObject implements ResultSetMetaData { > private final ReturnObjectList myNames = > new ReturnObjectList("MockResultSetMetaData.columnNames"); > private final ReturnObjectList myTypes = > > Index: CommonMockPreparedStatement.java > =================================================================== > RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockPreparedStatement.java,v > retrieving revision 1.2 > retrieving revision 1.3 > diff -u -r1.2 -r1.3 > --- CommonMockPreparedStatement.java 9 Sep 2002 12:13:53 -0000 1.2 > +++ CommonMockPreparedStatement.java 9 Dec 2002 18:20:12 -0000 1.3 > @@ -75,7 +75,7 @@ > * @author Ted Husted > * @version $Revision$ $Date$ > */ > -public abstract class CommonMockPreparedStatement > +abstract class CommonMockPreparedStatement > extends CommonMockStatement implements PreparedStatement { > > // -------------------------------------------------------------------- fields > > Index: CommonMockMultiRowResultSet.java > =================================================================== > RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockMultiRowResultSet.java,v > retrieving revision 1.2 > retrieving revision 1.3 > diff -u -r1.2 -r1.3 > --- CommonMockMultiRowResultSet.java 4 Dec 2002 12:39:23 -0000 1.2 > +++ CommonMockMultiRowResultSet.java 9 Dec 2002 18:20:12 -0000 1.3 > @@ -1,21 +1,13 @@ > package com.mockobjects.sql; > > -import java.sql.*; > -import java.sql.Date; > -import java.util.*; > -import java.math.BigDecimal; > -import java.io.InputStream; > -import java.io.Reader; > - > -import junit.framework.Assert; > -import junit.framework.AssertionFailedError; > -import com.mockobjects.*; > +import java.sql.SQLException; > > /** > * This is a simple implementation of a MockResultSet. > * It returns values for multiple rows. > + * @version $Revision$ > */ > -public abstract class CommonMockMultiRowResultSet extends MockResultSet { > +abstract class CommonMockMultiRowResultSet extends MockResultSet { > private Object[][] myRows = new Object[0][0]; > private String[] myColumnNames; > private int myRowOffset = -1; > > Index: CommonMockConnection2.java > =================================================================== > RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockConnection2.java,v > retrieving revision 1.1 > retrieving revision 1.2 > diff -u -r1.1 -r1.2 > --- CommonMockConnection2.java 4 Dec 2002 12:39:23 -0000 1.1 > +++ CommonMockConnection2.java 9 Dec 2002 18:20:13 -0000 1.2 > @@ -84,7 +84,7 @@ > import java.sql.PreparedStatement; > import java.sql.SQLException; > > -public abstract class CommonMockConnection2 extends CommonMockConnection implements Connection { > +abstract class CommonMockConnection2 extends CommonMockConnection implements Connection { > > private final ReturnObjectBag myPreparedStatements; > > > Index: CommonMockConnection.java > =================================================================== > RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockConnection.java,v > retrieving revision 1.5 > retrieving revision 1.6 > diff -u -r1.5 -r1.6 > --- CommonMockConnection.java 4 Dec 2002 12:39:23 -0000 1.5 > +++ CommonMockConnection.java 9 Dec 2002 18:20:14 -0000 1.6 > @@ -83,7 +83,7 @@ > import java.sql.*; > import java.util.Map; > > -public abstract class CommonMockConnection extends MockObject implements Connection { > +abstract class CommonMockConnection extends MockObject implements Connection { > > // -------------------------------------------------------------------- fields > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev -- Jeff Martin <je...@mk...> mkodo |
From: Jeff M. <cus...@us...> - 2002-12-09 18:20:23
|
Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql In directory sc8-pr-cvs1:/tmp/cvs-serv27540/src/jdk/common/com/mockobjects/sql Modified Files: MockResultSet.java CommonMockStatement.java CommonMockSingleRowResultSet.java CommonMockResultSetMetaData.java CommonMockPreparedStatement.java CommonMockMultiRowResultSet.java CommonMockConnection2.java CommonMockConnection.java Log Message: Changes around MockConnection2 Index: MockResultSet.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/MockResultSet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- MockResultSet.java 9 Sep 2002 12:13:53 -0000 1.3 +++ MockResultSet.java 9 Dec 2002 18:20:09 -0000 1.4 @@ -56,13 +56,10 @@ * */ -// ------------------------------------------------------------------------ 78 - package com.mockobjects.sql; import com.mockobjects.ExpectationCounter; import com.mockobjects.MockObject; -import junit.framework.AssertionFailedError; import java.io.InputStream; import java.io.Reader; @@ -83,20 +80,21 @@ */ abstract public class MockResultSet extends MockObject implements ResultSet { - -// -------------------------------------------------------------------- fields - - private ExpectationCounter myCloseCalls = - new ExpectationCounter("MockResultSet.close"); - - protected ExpectationCounter myNextCalls = - new ExpectationCounter("MockResultSet.next"); + private final ExpectationCounter myCloseCalls; + protected final ExpectationCounter myNextCalls; private ResultSetMetaData myMetaData; private Statement myStatement; -// -------------------------------------------------------------- setExpected* + public MockResultSet() { + this(MockResultSet.class.getName()); + } + + public MockResultSet(String name) { + myCloseCalls =new ExpectationCounter(name+".close"); + myNextCalls =new ExpectationCounter(name+".next"); + } public void setExpectedCloseCalls(int calls) { myCloseCalls.setExpected(calls); Index: CommonMockStatement.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockStatement.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CommonMockStatement.java 8 Jul 2002 18:30:37 -0000 1.2 +++ CommonMockStatement.java 9 Dec 2002 18:20:10 -0000 1.3 @@ -7,11 +7,14 @@ import java.sql.*; -public abstract class CommonMockStatement extends MockObject implements Statement { - protected ExpectationCounter myCloseCalls = new ExpectationCounter("CommonMockStatement.closeCalls"); - protected ExpectationCounter myExecuteCalls = new ExpectationCounter("CommonMockStatement.executeCalls"); - protected ExpectationValue myQueryString = new ExpectationValue("CommonMockStatement.queryString"); - protected ReturnObjectList myResultSets = new ReturnObjectList("result set"); +/** + * @version $Revision$ + */ +abstract class CommonMockStatement extends MockObject implements Statement { + protected final ExpectationCounter myCloseCalls = new ExpectationCounter("CommonMockStatement.closeCalls"); + protected final ExpectationCounter myExecuteCalls = new ExpectationCounter("CommonMockStatement.executeCalls"); + protected final ExpectationValue myQueryString = new ExpectationValue("CommonMockStatement.queryString"); + protected final ReturnObjectList myResultSets = new ReturnObjectList("result set"); private int myUpdateCount = 0; private SQLException myExecuteException = null; Index: CommonMockSingleRowResultSet.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockSingleRowResultSet.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CommonMockSingleRowResultSet.java 9 Sep 2002 12:13:53 -0000 1.2 +++ CommonMockSingleRowResultSet.java 9 Dec 2002 18:20:11 -0000 1.3 @@ -78,8 +78,9 @@ * set the corresponding value to be of type SQLException. * @author Jeff Martin * @author Ted Husted + * @version $Revision$ */ -public abstract class CommonMockSingleRowResultSet extends MockResultSet { +abstract class CommonMockSingleRowResultSet extends MockResultSet { // -------------------------------------------------------------------- fields Index: CommonMockResultSetMetaData.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockResultSetMetaData.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CommonMockResultSetMetaData.java 30 Aug 2002 14:49:58 -0000 1.1 +++ CommonMockResultSetMetaData.java 9 Dec 2002 18:20:11 -0000 1.2 @@ -8,9 +8,9 @@ import java.sql.SQLException; /** - * $Revision$ + * @version $Revision$ */ -public abstract class CommonMockResultSetMetaData extends MockObject implements ResultSetMetaData { +class CommonMockResultSetMetaData extends MockObject implements ResultSetMetaData { private final ReturnObjectList myNames = new ReturnObjectList("MockResultSetMetaData.columnNames"); private final ReturnObjectList myTypes = Index: CommonMockPreparedStatement.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockPreparedStatement.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CommonMockPreparedStatement.java 9 Sep 2002 12:13:53 -0000 1.2 +++ CommonMockPreparedStatement.java 9 Dec 2002 18:20:12 -0000 1.3 @@ -75,7 +75,7 @@ * @author Ted Husted * @version $Revision$ $Date$ */ -public abstract class CommonMockPreparedStatement +abstract class CommonMockPreparedStatement extends CommonMockStatement implements PreparedStatement { // -------------------------------------------------------------------- fields Index: CommonMockMultiRowResultSet.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockMultiRowResultSet.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CommonMockMultiRowResultSet.java 4 Dec 2002 12:39:23 -0000 1.2 +++ CommonMockMultiRowResultSet.java 9 Dec 2002 18:20:12 -0000 1.3 @@ -1,21 +1,13 @@ package com.mockobjects.sql; -import java.sql.*; -import java.sql.Date; -import java.util.*; -import java.math.BigDecimal; -import java.io.InputStream; -import java.io.Reader; - -import junit.framework.Assert; -import junit.framework.AssertionFailedError; -import com.mockobjects.*; +import java.sql.SQLException; /** * This is a simple implementation of a MockResultSet. * It returns values for multiple rows. + * @version $Revision$ */ -public abstract class CommonMockMultiRowResultSet extends MockResultSet { +abstract class CommonMockMultiRowResultSet extends MockResultSet { private Object[][] myRows = new Object[0][0]; private String[] myColumnNames; private int myRowOffset = -1; Index: CommonMockConnection2.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockConnection2.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CommonMockConnection2.java 4 Dec 2002 12:39:23 -0000 1.1 +++ CommonMockConnection2.java 9 Dec 2002 18:20:13 -0000 1.2 @@ -84,7 +84,7 @@ import java.sql.PreparedStatement; import java.sql.SQLException; -public abstract class CommonMockConnection2 extends CommonMockConnection implements Connection { +abstract class CommonMockConnection2 extends CommonMockConnection implements Connection { private final ReturnObjectBag myPreparedStatements; Index: CommonMockConnection.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockConnection.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- CommonMockConnection.java 4 Dec 2002 12:39:23 -0000 1.5 +++ CommonMockConnection.java 9 Dec 2002 18:20:14 -0000 1.6 @@ -83,7 +83,7 @@ import java.sql.*; import java.util.Map; -public abstract class CommonMockConnection extends MockObject implements Connection { +abstract class CommonMockConnection extends MockObject implements Connection { // -------------------------------------------------------------------- fields |
From: Jeff M. <je...@cu...> - 2002-12-09 18:11:39
|
Was going to mention that. The apache guys have been building mo as part of there integration build. Since they were building it anyway I gave them a patch to let us know if there where any problems with the build. Not quite sure what the actually problem might be a problem on the 1.4 base. I'll try and sort it asap but I'm off sight for a couple of weeks. So it might take a day or so. On Sat, 2002-12-07 at 20:21, Steve Freeman wrote: > What's this about, then? > > Jeff Martin wrote: > > ---------------------------------------------------- > > This email is autogenerated from the output from: > > <http://cvs.apache.org/builds/gump/2002-12-07/mockobjects.html> > > ---------------------------------------------------- > > > > Buildfile: build.xml > > > > project-properties: > > > > deliverable-names: > > > > 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. > > > > call-me-first: > > [echo] --------- Mock Objects 20021207 --------- > > > > [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_01/lib/tools.jar:/usr/java/j2sdk1.4.1_01/jre/lib/rt.jar:/usr/java/j2sdk1.4.1_01/lib/tools.jar:/home/rubys/jakarta/jakarta-ant/dist/lib/ant.jar:/home/rubys/jakarta/jakarta-ant/dist/lib/nodeps.jar:/home/rubys/jakarta/jakarta-ant/dist/lib/ant-junit.jar:/home/rubys/jakarta/jakarta-ant/dist/lib/ant-stylebook.jar:/home/rubys/jakarta/jakarta-ant/dist/lib/ant-swing.jar:/home/rubys/jakarta/jakarta-ant/dist/lib/ant-trax.jar:/home/rubys/jakarta/jakarta-ant/dist/lib/ant-xalan2.jar:/home/rubys/jakarta/dist/junit/junit.jar:/home/rubys/jakarta/mockobjects/out/core/classes:/home/rubys/jakarta/mockobjects/out/jdk/classes > > > > [echo] java.home = /usr/java/j2sdk1.4.1_01/jre > > [echo] user.home = /home/rubys > > [echo] ant.home = ${ant.home} > > > > > > compile-core: > > [javac] Compiling 67 source files to /home/rubys/jakarta/mockobjects/out/core/classes > > > > compile-jdk: > > [javac] Compiling 42 source files to /home/rubys/jakarta/mockobjects/out/jdk/classes > > [javac] /home/rubys/jakarta/mockobjects/src/jdk/common/com/mockobjects/sql/CommonMockMultiRowResultSet.java:30: cannot resolve symbol > > [javac] symbol : constructor MockResultSet (java.lang.String) > > [javac] location: class com.mockobjects.sql.MockResultSet > > [javac] super(name); > > [javac] ^ > > [javac] Note: Some input files use or override a deprecated API. > > [javac] Note: Recompile with -deprecation for details. > > [javac] 1 error > > > > BUILD FAILED > > file:///home/rubys/jakarta/mockobjects/build.xml:143: Compile failed; see the compiler error output for details. > > > > Total time: 5 seconds > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > _______________________________________________ > > 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: Jeff M. <je...@cu...> - 2002-12-09 13:23:35
|
---------------------------------------------------- This email is autogenerated from the output from: <http://cvs.apache.org/builds/gump/2002-12-09/mockobjects.html> ---------------------------------------------------- Buildfile: build.xml project-properties: deliverable-names: 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. call-me-first: [echo] --------- Mock Objects 20021209 --------- [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_01/lib/tools.jar:/usr/java/j2sdk1.4.1_01/jre/lib/rt.jar:/usr/java/j2sdk1.4.1_01/lib/tools.jar:/home/rubys/jakarta/jakarta-ant/dist/lib/ant.jar:/home/rubys/jakarta/jakarta-ant/dist/lib/nodeps.jar:/home/rubys/jakarta/jakarta-ant/dist/lib/ant-junit.jar:/home/rubys/jakarta/jakarta-ant/dist/lib/ant-stylebook.jar:/home/rubys/jakarta/jakarta-ant/dist/lib/ant-swing.jar:/home/rubys/jakarta/jakarta-ant/dist/lib/ant-trax.jar:/home/rubys/jakarta/jakarta-ant/dist/lib/ant-xalan2.jar:/home/rubys/jakarta/dist/junit/junit.jar:/home/rubys/jakarta/mockobjects/out/core/classes:/home/rubys/jakarta/mockobjects/out/jdk/classes [echo] java.home = /usr/java/j2sdk1.4.1_01/jre [echo] user.home = /home/rubys [echo] ant.home = ${ant.home} compile-core: [javac] Compiling 67 source files to /home/rubys/jakarta/mockobjects/out/core/classes compile-jdk: [javac] Compiling 42 source files to /home/rubys/jakarta/mockobjects/out/jdk/classes [javac] /home/rubys/jakarta/mockobjects/src/jdk/common/com/mockobjects/sql/CommonMockMultiRowResultSet.java:30: cannot resolve symbol [javac] symbol : constructor MockResultSet (java.lang.String) [javac] location: class com.mockobjects.sql.MockResultSet [javac] super(name); [javac] ^ [javac] Note: Some input files use or override a deprecated API. [javac] Note: Recompile with -deprecation for details. [javac] 1 error BUILD FAILED file:///home/rubys/jakarta/mockobjects/build.xml:143: Compile failed; see the compiler error output for details. Total time: 13 seconds |
From: Vincent M. <vm...@oc...> - 2002-12-08 19:41:03
|
Hi, Please find attached a patch to support the ResultSetMetaData.getColumnClassName() method. Thanks -Vincent |