| To: | CinJug <users@xxxxxxxxxx> |
|---|---|
| Subject: | Re: [cinjug-users] File Mocks |
| From: | Mark Windholtz <windholtz@xxxxxxxxx> |
| Date: | Thu, 17 Nov 2005 12:48:00 -0500 |
| Delivered-to: | mailing list users@cinjug.org |
| Domainkey-signature: | a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-mailer; b=uLKYjd/9/5hpOqMPyU1ytXN1aTFaomvfTZEx8tz2kU9ZcWEqtcySpTX9pVtexhcIDNzUBnoXGKvwE74jb455LRobo6ea3Y39E4BsjauGnHEfjID4g6xoe/NuBCt4846wd1k7wf5sQnJIOvSBZlpjUrJDUrssWV7tc23AEbdeJVY= |
| In-reply-to: | <000901c5eb76$897d3680$6401a8c0@CARMANI9300> |
| Mailing-list: | contact users-help@cinjug.org; run by ezmlm |
| References: | <000901c5eb76$897d3680$6401a8c0@CARMANI9300> |
|
On Nov 17, 2005, at 07:57 AM, James Carman wrote: You'd probably have to do a LOT of work to get the mock to work correctly
When your dealing with an API without interfaces you just /have/ to work hard to break dependencies. Luckily, File and it's methods are not 'final'. So another possibility is to subclass File and over-ride the methods you are interested in on a test-by-test basis. (this technique is often called a "shunt"). Inner classes can be used for creating the shunt. If your only using a few File methods over-riding is a good enough option. But then you still have to build an injection mechanizum to get the shunted File from the test into the target.
Regards, - Mark Windholtz (513) 226-8259 railsstudio.com |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [cinjug-users] XML Schema validation, John Olmstead |
|---|---|
| Next by Date: | RE: [cinjug-users] XML Schema validation, Bullock, Jeffrey A. |
| Previous by Thread: | RE: [cinjug-users] File Mocks, James Carman |
| Next by Thread: | RE: [cinjug-users] File Mocks, Scott T Weaver |
| Indexes: | [Date] [Thread] [Top] [All Lists] |