Nick Robinson | 1 Mar 2003 10:01
Picon
Favicon

RE: TDD with writing out files in a certain structure


-----Original Message-----
From: Dave Astels <dave <at> saorsa.com> [mailto:dave <at> saorsa.com]
Sent: 28 February 2003 18:37
To: testdrivendevelopment <at> yahoogroups.com
Subject: Re: [TDD] TDD with writing out files in a certain structure

--- In testdrivendevelopment <at> yahoogroups.com, "Nick Robinson"
<nicholasrobinson <at> y...> wrote:
>
> > -----Original Message-----
> > From: Dave Astels <dave <at> s...> [mailto:dave <at> s...]

> > Pass the stream to write to (maybe even a Writer instance) to the
> > things that's doign the writing. If they are clear text files, you
> > can use a StringWriter.  To test ask for the string with toString()
> > and verify that.

> Ok now that makes sense.  One question (and maybe I am not thinking
> hard enough as its been a long day).  I dont want to have some code
> external to my writer classes to create a stream and then pass it
> into the writers.  These writers will be invokved by some other
> responsible classes in the end, and I dont want them to even worry
> about streams.

First, why not?

NR> Maybe I shouldnt worry about that aspect right now.  I guess the
business class could ask a factory for a stream and then pass that in,
though I prefer encapsulating all of that, and the factory method you
mention below seems reasonable. That has given me some food for thought
Dave, thanks.

You could use a Factory.  But then you need to get hold of the output.
You could use a Factory Method in the writer class to create the
stream, and in the test specializelize it (with an anon inner
class)and override the Factory Method to return a Stream decalred in
your test, or Mock etc.

Dave

Yahoo! Groups Sponsor
ADVERTISEMENT

To unsubscribe from this group, send an email to:
testdrivendevelopment-unsubscribe <at> yahoogroups.com

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/LIgTpC/vN2EAA/xGHJAA/NhFolB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
testdrivendevelopment-unsubscribe <at> yahoogroups.com

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


Gmane