You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(30) |
Sep
(19) |
Oct
(3) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(11) |
Feb
(13) |
Mar
(10) |
Apr
(11) |
May
(7) |
Jun
(8) |
Jul
(5) |
Aug
(16) |
Sep
(14) |
Oct
(3) |
Nov
(9) |
Dec
|
2003 |
Jan
(5) |
Feb
(6) |
Mar
(9) |
Apr
(31) |
May
(25) |
Jun
(22) |
Jul
(28) |
Aug
(27) |
Sep
(19) |
Oct
(4) |
Nov
(7) |
Dec
(26) |
2004 |
Jan
(8) |
Feb
(13) |
Mar
(5) |
Apr
(8) |
May
(8) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
2005 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2008 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
(3) |
May
|
Jun
|
Jul
(6) |
Aug
|
Sep
(10) |
Oct
(6) |
Nov
|
Dec
(36) |
2009 |
Jan
(3) |
Feb
(14) |
Mar
(13) |
Apr
(18) |
May
(35) |
Jun
(18) |
Jul
(27) |
Aug
(6) |
Sep
(2) |
Oct
|
Nov
|
Dec
(10) |
2010 |
Jan
(6) |
Feb
(1) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
From: Jeff M. <je...@mk...> - 2003-04-07 17:49:25
|
We've used them for testing sending multipart mime mails. The sun classes are not really mockable so we've created a mockable version of the api in the alt packages. Alt classes http://www.mockobjects.com/javadoc/1.3/alt/javax/mail/internet/package-summary.html http://www.mockobjects.com/javadoc/1.3/alt/javax/mail/package-summary.html Mocks http://www.mockobjects.com/javadoc/1.3/com/mockobjects/mail/package-summary.html http://www.mockobjects.com/javadoc/1.3/com/mockobjects/mail/internet/package-summary.html On Mon, 2003-04-07 at 17:02, Pascal Heraud wrote: > Hi! > > Does someone already used MockObjects for testing mail sending ? > I did no seen any javamail.providers file or javamail.default.providers > into sources or distribs ? > Or is there a mean to configure MockObjects providers at runtime ? > > Pascal. > > > > ------------------------------------------------------- > This SF.net email is sponsored by: ValueWeb: > Dedicated Hosting for just $79/mo with 500 GB of bandwidth! > No other company gives more support or power for your dedicated server > http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ > _______________________________________________ > Mockobjects-java-users mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-users |
From: Pascal H. <pas...@ke...> - 2003-04-07 16:01:26
|
Hi! Does someone already used MockObjects for testing mail sending ? I did no seen any javamail.providers file or javamail.default.providers into sources or distribs ? Or is there a mean to configure MockObjects providers at runtime ? Pascal. |
From: Asbell, J. <Jon...@Mc...> - 2003-04-01 22:21:05
|
We are trying to supply a HashMap of name/value pairs representing column name and column value for a row: mockResult.addExpectedNamedValues(myHashMapFullOfRowData); I create mock row data in this fashion..... ================================= MockDataSource mockDataSource = new MockDataSource(); MockConnection mockConn = new MockConnection(); MockStatement mockStatement = new MockStatement(); MockSingleRowResultSet mockResult = new MockSingleRowResultSet(); expectedDataHashMap.put("ORDER DATE", new java.sql.Date(System.currentTimeMillis())); When I execute I retrieve the data in the following manner..... ================================= anotherHashMap.put("ORDER DATE", resultSet.getDate("ORDER_DATE").toString()); ......an Exception gets thrown on the line above........ CommonMockSingleRowResultSet.SqlRow keys did not receive an expected item Unexpected:ORDER_DATE; Am I forgetting to set something in a relevant Mock Sql Object? |
From: Jeff M. <je...@mk...> - 2003-03-26 12:01:27
|
You can get them from the CVS repository on source forge http://sourceforge.net/cvs/?group_id=18189 On Wed, 2003-03-26 at 11:40, Oren Gross wrote: > anyone knows were can I ge them? > > ----------------------------------------------------------------- > > Oren Gross Java(TM) Developer > > Mercury Interactive APM TAC R&D > > +972-3-5399407 og...@me... > > |
From: Oren G. <og...@me...> - 2003-03-26 11:43:16
|
anyone knows were can I ge them? ----------------------------------------------------------------- Oren Gross Java(TM) Developer Mercury Interactive APM TAC R&D +972-3-5399407 og...@me... |
From: Jeff M. <je...@mk...> - 2003-03-17 09:47:38
|
Why? On Sat, 2003-03-15 at 00:24, Vincent Massol wrote: > FYI. That looks very promising (downloading it now). A pity it is not > open source :-). When are we going to start implementing something > similar? ;-) (I know, the OS rule is: if you want it, just do it...). > > -Vincent > > > -----Original Message----- > > From: rupertthomas [mailto:ru...@po...] > > Sent: 14 March 2003 17:26 > > To: ju...@ya... > > Subject: [junit] Polygenix AgileTest - Mock Object Testing Suite > > > > We've just announced the release of an Early Access Preview of > > our AgileTest mock object testing solution. Agiletest differs from > > other mock object implementations in that it operates at the bytecode > > level. Other implementations are generally based on either > > straightforward source-code generation, or the insertion of a dynamic > > proxy. The former approach increases the number of artefacts in your > > development project (which must also be kept in synchronisation with > > development) whilst the latter is limited to the mocking of > > interfaces. The upshot is that, using AgileTest, it is possible to > > create mocks (or Imposters) of classes as well as interfaces, without > > requiring source code for the class under test and without generating > > a pile of additional source files. > > > > AgileTest also includes another neat feature - Interlopers - which > > allows for dynamic object substitution at any point in the class > > under test, allowing for comprehensive mock-based testing of non > > parameterized object collaborations. This means that common > > programming idioms like static factory calls, or JNDI InitialContext > > calls in EJBs, can now be successfully mocked. > > > > > > ------------------------ Yahoo! Groups Sponsor > ---------------------~--> > > Get 128 Bit SSL Encryption! > > http://us.click.yahoo.com/xaxhjB/hdqFAA/xGHJAA/5cFolB/TM > > > ---------------------------------------------------------------------~-> > > > > To unsubscribe from this group, send an email to: > > jun...@ya... > > > > > > Your use of Yahoo! Groups is subject to > http://docs.yahoo.com/info/terms/ > > > > > > > ------------------------------------------------------- > This SF.net email is sponsored by:Crypto Challenge is now open! > Get cracking and register here for some mind boggling fun and > the chance of winning an Apple iPod: > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en > _______________________________________________ > Mockobjects-java-users mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-users |
From: Vincent M. <vm...@pi...> - 2003-03-15 00:25:16
|
FYI. That looks very promising (downloading it now). A pity it is not open source :-). When are we going to start implementing something similar? ;-) (I know, the OS rule is: if you want it, just do it...). -Vincent > -----Original Message----- > From: rupertthomas [mailto:ru...@po...] > Sent: 14 March 2003 17:26 > To: ju...@ya... > Subject: [junit] Polygenix AgileTest - Mock Object Testing Suite > > We've just announced the release of an Early Access Preview of > our AgileTest mock object testing solution. Agiletest differs from > other mock object implementations in that it operates at the bytecode > level. Other implementations are generally based on either > straightforward source-code generation, or the insertion of a dynamic > proxy. The former approach increases the number of artefacts in your > development project (which must also be kept in synchronisation with > development) whilst the latter is limited to the mocking of > interfaces. The upshot is that, using AgileTest, it is possible to > create mocks (or Imposters) of classes as well as interfaces, without > requiring source code for the class under test and without generating > a pile of additional source files. > > AgileTest also includes another neat feature - Interlopers - which > allows for dynamic object substitution at any point in the class > under test, allowing for comprehensive mock-based testing of non > parameterized object collaborations. This means that common > programming idioms like static factory calls, or JNDI InitialContext > calls in EJBs, can now be successfully mocked. > > > ------------------------ Yahoo! Groups Sponsor ---------------------~--> > Get 128 Bit SSL Encryption! > http://us.click.yahoo.com/xaxhjB/hdqFAA/xGHJAA/5cFolB/TM > ---------------------------------------------------------------------~-> > > To unsubscribe from this group, send an email to: > jun...@ya... > > > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ > |
From: Steve F. <st...@m3...> - 2003-03-10 21:39:53
|
This is partly a problem with the language, which won't let us override=20 on the class side. That said, one of the points of MO is to push you to do the Right Thing.=20 In this case, many of us believe that this sort of static method just=20 gets you into trouble and should be on the instance side, so wrapping it=20 up is a step in the right direction. S. DeS...@em... wrote: > I think you are out of luck. In this case, I would try to refactor > MyBackEndClass so I can call an instance method. I suspect MyBackendCla= ss > implements some interface like MyBackendInterface, otherwise you wouldn= 't be > able to mock it. My approach would be to decouple the retrieval of the > back-end object from the method that uses this object. Something like t= his: > [...] --=20 [Advert: Come to http://www.ot2003.org] "What=92s the difference between a C programmer and a LISP programmer? A=20 LISP programmer knows the value of everything but the cost of nothing.A=20 C programmer knows the cost of everything but the value of nothing." (Todd Proebsting) |
From: <DeS...@em...> - 2003-03-10 16:20:47
|
Herman, > (1) Listing : The class under test > > class MyClass { > > // ---- > public void myMethod () { > // .. Blah ... > MyBackEndClass.callStaticMethod () ; > // ^^^ i want to mock this object > } > > } > > What i want to do is to create a mock object, say > MockMyBackEndClass and call a method (static?) on it, > thus avoiding actual call to backend. The problem is that > i cannot override static method. So even if i subclass > MyBackEndClass to create a MockMyBackEndClass, > MockMyBackEndClass.callStaticMethod() will always call > implementation in MyBackEndClass ... > If the method callStaticMethod were not static, it's quite > straightforward to substitute actual MyBackEndClass to > MockMyBackEndClass in the test code... but it isn't ... :-( I think you are out of luck. In this case, I would try to refactor MyBackEndClass so I can call an instance method. I suspect MyBackendClass implements some interface like MyBackendInterface, otherwise you wouldn't be able to mock it. My approach would be to decouple the retrieval of the back-end object from the method that uses this object. Something like this: class MyClass { // ---- public void myMethod () { this.myMethod(BackendLookup.getBackendObject()); } protected void myMethod(MyBackEndInterface backendObject) { // .. Blah ... backendObject.callInstanceMethod () ; // .. More blah ... } } You can then write unit tests for myMethod(MyBackEndInterface) providing the mock version as an argument. I also assume that you write other unit tests for the BackendLookup class. Ringo |
From: Olaf K. <ok...@ab...> - 2003-03-10 15:53:05
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 her...@so... wrote: | Hi all, | | Here is my question : the object i want to mock has static methods (which | connect to back-end through a stack of numerous layer ...), and i want to | isolate my test from this back-end dependency. But the problem is that | static method cannot be overriden...so how could i achieve this ??? | | Any help will be appreciated Simple: Don't use the class that contains static methods from everywhere in your code. Create a *very* thin layer that has the same methods nonstatic and only delegates to the static version. This is the *only* user of the static methods. Then extract an interface from your layer. This is the basis for your mock implementation. Olaf -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQE+bLS87/xtFKqdCzURAi1vAKCGksABlPnz+0pCRE+X7Ygw0FarOgCfVGoy Kr6Gxlq5yXmN1NVsuXlGsxc= =IswN -----END PGP SIGNATURE----- |
From: <DeS...@em...> - 2003-03-10 15:02:22
|
Herman, > Here is my question : the object i want to mock has static > methods (which connect to back-end through a stack of numerous layer ...), > and i want to isolate my test from this back-end dependency. But the problem > is that static method cannot be overriden...so how could i achieve this ??? > > Any help will be appreciated Your mock object only implements the methods from the interface that your object implements. Since you can't define static methods on an interface, you can't provide mock implementations for them. Don't forget that the object you are mocking is *not* the object under test. Please provide some code snippets if my answer doesn't cover your request. Ringo |
From: <her...@so...> - 2003-03-10 14:30:35
|
Hi all, Here is my question : the object i want to mock has static methods (which connect to back-end through a stack of numerous layer ...), and i want to isolate my test from this back-end dependency. But the problem is that static method cannot be overriden...so how could i achieve this ??? Any help will be appreciated /hermann http://hrangamana.free.fr ************************************************************************* Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout message electronique est susceptible d'alteration. La SOCIETE GENERALE et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie. ******** This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration. Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or falsified. ************************************************************************* |
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----- |
From: <ric...@vo...> - 2003-02-28 13:07:48
|
Hi Jeff You are right... I should have been more carefully in my posting and read better what's already there... Sorry for the inconvenience. Richard. > -----Original Message----- > From: Jeff Martin [mailto:je...@mk...] > Sent: Friday, February 28, 2003 01:53 PM > To: ric...@vo... > Cc: moc...@li... > Subject: Re: [MO-java-users] CommonMockPreparedStatement is using > ExpectationSet:no guaranteed iteration order > > > 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: 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: 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: <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: cpp g. <cpp...@ho...> - 2003-02-24 16:29:30
|
FYI: If you are in the San Diego area, come see on Mar 6 for a Mock Objects demonstration. See below for more details. John ---- XPSD mailing list: http://groups.yahoo.com/groups/xpsandiego/join XPSD website : www.xpsd.com contacts : Carlton Nettleton: cne...@sa... June Clarke : joo...@ya... John Arrizza : cpp...@ho... >Reply-To: xps...@ya... >To: xps...@ya... >The XP-San Diego users group will be holding our next meeting: > > > >Thursday Mar 6 from 6 - 8PM. > > > >The topic is "Mock Objects" presented by Kral Ferch. > > > >Kral is a firm believer in the eXtreme Programming approach to software >development. For the last 2 years, he has been trying to use XP as much as >possible as well as evangelizing it to others. For his talk, he will first >answer the questions "What are Mock Objects?" and "Why should I use them?" >Then he will present some sample C# code showing a couple of different ways >to implement Mock Objects. > > > >For people who want a little head start, the site > >http://www.mockobjects.com was the inspiration for much of this talk. > > > >This is an open meeting; please invite anyone interested in XP or Mock >Objects! Please RSVP by replying to this email so that an appropriately >sized room can be scheduled. > > > >Alaris Medical is hosting the meeting. Thanks again to Nobuo Fukaya for >allowing us to use Alaris's site! > > > >The address is: Building A, 2nd floor, Conference room 2D 10221 Wateridge >Circle > > > >http://www.mapquest.com/maps/map.adp?country=US&;addtohistory=&address=10221+Wateridge+Circle&city=san+diego&state=ca&zipcode=&homesubmit.x=24&homesubmit.y=15 > > > >Wateridge is two exits off of Lusk. If you take the East-most exit, you >will arrive at the entrance with the buildings on your left and a parking >structure on your right. Park there and walk up two sets of stairs to the >second floor main foyer of building A. > > > >If you take the West-most exit, you can park on the street and walk to the >second floor main foyer directly. > > > > > > > >http://www.xpsd.com > > > >--------------------------------- >Do you Yahoo!? >Yahoo! Shopping - Send Flowers for Valentine's Day _________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus |
From: <Vin...@ge...> - 2003-01-31 19:05:42
|
If I undertand correctly, you're trying to test that your string message is being set as the text of your TextMessage object. You might want to change your test like this: // Junit test public void testJmsMessageCreation() { SomeDataObject data = new SomeDataObject(); data.fillWithSomeExtremelyImportantInformation(); MockQueueSession mqs = new MockQueueSession(); MockTextMessage mockMessage = new MockTextMessage(); mockMessage.setExpectedText(putYourExpectedValueHere); mqs.setupTextMessage(mockMessage); TextMessage tm = createJmsMessage(data, mqs); // What to do here? getText() returns null :-( // Don't actually have to do anything here in this case, // although it's good practise to call verify on mockobjects that have expectations, so: mockMessage.verify(); } The nice thing is that the test assertion is inside the MockTextMessage class and it will break immediatly if the value fed to setText() is not the expected value. Keep in mind though that it's not always the case for other test assertions so you should call verify() at the end of the test. Vincent -----Original Message----- From: Hlodver Tomasson [mailto:hto...@ba...] Sent: Friday, January 31, 2003 11:49 To: 'Vincent Tencé' Subject: RE: [MO-java-users] JMS MockTextMessage.getText() doesn't return the value set in setText(s) Hi Vincent and thanks for a quick response. (I didn't see your reply on the message thread so I'm backfiring this to you :) Here's a raw version of what I'm trying to do: // Method under test public javax.jms.Message createJmsMessage(SomeDataObject data, javax.jms.QueueSession qs) { String message = data.getDesiredMessage(); javax.jms.TextMessage tm = qs.createTextMessage( message ); return tm; } // Junit test public void testJmsMessageCreation() { SomeDataObject data = new SomeDataObject(); data.fillWithSomeExtremelyImportantInformation(); MockQueueSession mqs = new MockQueueSession(); TextMessage tm = createJmsMessage(data, mqs); // What to do here? getText() returns null :-( } Am I missing something? The problem is probably that I don't have access to the MockTextMessage before I call the domain code, and that's maybe not the way MockObjects are used in general. (I'm a newbie by the way, but used JUnit for quite a while now and I like the MO idea a lot). Kindest regards, Hlodver -----Original Message----- From: Vincent Tencé [mailto:Vin...@ge...] Sent: 31. janúar 2003 15:03 To: 'Hlodver Tomasson' Subject: RE: [MO-java-users] JMS MockTextMessage.getText() doesn't return the value set in setText(s) Hi Hlodver, The idea when testing your code against MockTextMessage is that you want to make sure that value fed to setText() by the code under test is the value you expect to receive. On the other hand, the value returned by the getText() method is used to test the behaviour of your code when it calls getText(). Use that value to simulate different text values in your TextMessage and see how the code under test reacts to these values. So it's not a classic getter/setter pattern. As for your problem, could you give more explanations on what you're trying to test and maybe post some code snippets. We'll try to work it out then. Vincent -----Original Message----- From: moc...@li... [mailto:moc...@li...]On Behalf Of Hlodver Tomasson Sent: Friday, January 31, 2003 08:36 To: 'moc...@li...' Subject: [MO-java-users] JMS MockTextMessage.getText() doesn't return the value set in setText(s) Hi, Why doesn't JMS MockTextMessage.getText() return the value set in MockTextMessage.setText()? (I'm using a factory method which returns a new TextMessage using QueueSession.createTextMessage(), and I can't call setExpectedText before I call setText() on the message) Regards, Hlodver |
From: Hlodver T. <hto...@ba...> - 2003-01-31 13:36:05
|
Hi, Why doesn't JMS MockTextMessage.getText() return the value set in MockTextMessage.setText()? (I'm using a factory method which returns a new TextMessage using QueueSession.createTextMessage(), and I can't call setExpectedText before I call setText() on the message) Regards, Hlodver |
From: <ric...@vo...> - 2003-01-30 10:10:28
|
Hi Torben, Can you be more specific on what kind of object MockHttpSession is complaining about? As far as I know, the ExpectationSet only complains if you try to get someting out of the mockobject that wasn't set or the other way around. Richard. > -----Original Message----- > From: Torben Tretau [mailto:wt...@tr...] > Sent: Thursday, January 30, 2003 10:41 AM > To: moc...@li... > Subject: [MO-java-users] MockHttpSession > > > Hi, > > I started to use the HttpSession from mockobjects-0.7, and > ran into trouble: > The thing is that I want to use the httpSession inside of an > action and check > if it contains an object after that action.. > The problem is, that the ExcpectationSet must fulfill all > things that the httpSession contains.. But I do only expect, > that it contains some object.. > > Is there any way to solve this? How should the > MockHttpSession be used? > > Torben > > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See! > http://www.vasoftware.com > _______________________________________________ > Mockobjects-java-users mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-users > |
From: Torben T. <wt...@tr...> - 2003-01-30 09:41:30
|
Hi, I started to use the HttpSession from mockobjects-0.7, and ran into trouble: The thing is that I want to use the httpSession inside of an action and check if it contains an object after that action.. The problem is, that the ExcpectationSet must fulfill all things that the httpSession contains.. But I do only expect, that it contains some object.. Is there any way to solve this? How should the MockHttpSession be used? Torben |
From: Griffin C. <gri...@ya...> - 2003-01-13 14:40:00
|
This is to announce that .NET Mock Objects library, version 0.3, has been release. New in this release: - Fully implemented IDataRead Mock Objects, which completes the implementation of the System.Data core classes. - Added a re-write of the MailingList example that comes with the mockobjects-java package - Cleaned up the XML documentation and API docs - Other, minor refactorings Link to release notes and change log here: https://sourceforge.net/project/shownotes.php?group_id=54948&release_id=133345 -Griffin ===== Griffin Caprio "Your child against mine. The winner will be hailed, the loser will be booed until my throat hurts!" - Homer Simpson to Marge __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com |
From: Steve F. <st...@m3...> - 2002-11-25 00:22:00
|
Barry Kaplan wrote: > Seems that the dynamic mocksobjects handle this quite nicely. Here's > what I did: The class I needed to test was an abstract class, so I could > not use Mock or MockObject directly. Instead I mocked just the abstract > hook methods required to the test the template methods. In the case of > the 'getQuantity' hook method, I did: > > private CallSet expectedGetQuantity1 = new CallSet(); > > // Just to provide an easier setup mechansim than having the test use > the CallSet directly > public void expectGetQuantity(Foo foo, Bar bar, Integer returnValue) { > expectedGetQuantity1.expectReturn( > new Constraint[]{P.eq(foo), P.eq(bar)}, returnValue); > } > > public int getQuantity(Foo foo, Bar bar) { > try > return ((Integer) expectedGetQuantity1.call(new Object[]{foo, > bar})).intValue(); > } catch (Throwable t) { > // It kinda sucks that call() declares Throwable. Its really > unecessary, since reflection will > // throw the exception of the reflected. If the reflected > method declares an exception > // the mock method can pass it thru (or extract it from the > exception the method.invoke() throws). > throw new RuntimeException(t); > } > } > > public void verify() throws AssertionFailedError { > expectedGetQuantity1.verify(); > ... > } For an equality test, I would have done something like: ExpectationValue foo = new ExpectationValue("foo"); ExpectationValue bar = new ExpectationValue("bar"); int quantity; public int getQuantity(Foo aFoo, Bar aBar) { foo.setActual(aFoo); bar.setActual(aBar); return quantity; } public void verify() { Verifier.verifyObject(this); } which I find more obvious. I might take shortcuts, like using an ExpectationList for all the parameters and, these days, I tend not to make the mock fields private and just call setExpected() on them directly. If you get the names right, it's pretty readable. S. |
From: Steve F. <st...@m3...> - 2002-11-25 00:15:44
|
Barry Kaplan wrote: > One of the big problem we ran into with mockobjects was the ability to > get back the values passed into mocks (vs. just having the mock assert > the values). For example, when testing a class that registers as a > listener [with some mock], we often want to get hold of that listener > instance (which may be the CUT or an inner of class of the CUT) and > invoke methods on the listener so as to test the listening behavior. > Implementations of Expectation all maintain the expected values as > private and provide no accessors, making this type of usage impossible. We probably should open up the instance variables, but we tend to use those forces to push the way we code. I don't really understand your example, could you post a snippet? > Back then I never really dug into the mockobjects code. Now, after > having done so, I see that the mockobjects implementation is clean and > simple, and most of limitations [for us] can easiliy be removed. We used > easymock for a while, but had same issues as with mockobjects. If you have time, could you describe them? > Thanks for the help Steve. my pleasure. > (I notice that all your responses post to both user and dev. Should that > be the normal practice?) not sure who's interested in this, so I'm resorting to a scattergun. Anyone prefer me not to? S. |