From: <ric...@vo...> - 2003-02-28 11:45:38
|
Hi all, We're using mockobjects heavily for our unit tests. Currently we're testing a sql-update with PreparedStatement. I noticed that CommonMockPreparedStatement is using ExpectationSet, which is using HashSet for internal storage. Since HashSet doesn't have a guaranteed iteration order, it is in my opinion not suitable for PreparedStatement. CommonMockPreparedStatement should use ExpectationList instead, so the order is guaranteed (which is very important in a PreparedStatement...) Richard. |
From: Steve F. <st...@m3...> - 2003-02-28 12:08:38
|
You may well be right. Anyone think the opposite? b.t.w. I'd love to hear more about your experiences. In the meantime, you might also want to take a look at the new dynamic mock stuff in the library. S. ric...@vo... wrote: > Hi all, > > We're using mockobjects heavily for our unit tests. > > Currently we're testing a sql-update with PreparedStatement. > > I noticed that CommonMockPreparedStatement is using ExpectationSet, which is > using HashSet for internal storage. Since HashSet doesn't have a guaranteed > iteration order, it is in my opinion not suitable for PreparedStatement. > CommonMockPreparedStatement should use ExpectationList instead, so the order > is guaranteed (which is very important in a PreparedStatement...) > > Richard. > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Mockobjects-java-users mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-users |
From: Jeff M. <je...@mk...> - 2003-02-28 12:54:14
|
I can't see quite what the issue is. Which ExpectationSet are we talking about? The expected parameters are being stored as key value pairs so setObject(1,"Stuff"); setObject(2,"More Stuff"); is the same as setObject(2,"More Stuff") ; setObject(1,"Stuff"); Are we talking about public void setObject(int param, Object anObject, int aTargetSQLType) which should maybe be calling setObject(param, new MapEntry(anObject, aTargetSQLType); but the order is still not important, it's the combintion of index, object, type which counts. ric...@vo... wrote: >Hi all, > >We're using mockobjects heavily for our unit tests. > >Currently we're testing a sql-update with PreparedStatement. > >I noticed that CommonMockPreparedStatement is using ExpectationSet, which is >using HashSet for internal storage. Since HashSet doesn't have a guaranteed >iteration order, it is in my opinion not suitable for PreparedStatement. >CommonMockPreparedStatement should use ExpectationList instead, so the order >is guaranteed (which is very important in a PreparedStatement...) > >Richard. > > >------------------------------------------------------- >This sf.net email is sponsored by:ThinkGeek >Welcome to geek heaven. >http://thinkgeek.com/sf >_______________________________________________ >Mockobjects-java-users mailing list >Moc...@li... >https://lists.sourceforge.net/lists/listinfo/mockobjects-java-users > > |
From: Olaf K. <ok...@ab...> - 2003-02-28 13:26:31
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jeff Martin wrote: | I can't see quite what the issue is. Which ExpectationSet are we talking | about? The expected parameters are being stored as key value pairs so | | setObject(1,"Stuff"); | setObject(2,"More Stuff"); | | is the same as | | setObject(2,"More Stuff") ; | setObject(1,"Stuff"); what about: addExpectedSetParameter(1, "firstpass") addExpectedSetParameter(2, "firstpass") addExpectedSetParameter(1, "secondpass") addExpectedSetParameter(2, "secondpass") setExpectedExecuteCalls(2) ... this is also passed by setParameter(1,"secondpass"); setParameter(2,"firstpass"); execute(); setParameter(1,"firstpass"); setParameter(2,"secondpass"); execute(); I personally can *well* live with this, as it allows to split expectations between setUp and test without much hassle. In my eyes there's no need to change (would probably break my tests :-) Best, Olaf -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQE+X2Nc7/xtFKqdCzURAgGZAJ0f3zXH2E3RXuLTFgIemuvNk0cUsQCgmfkK 3s+PobDWf/kYS2yLsIuyjl4= =eDCv -----END PGP SIGNATURE----- |