From: Jeff M. <je...@mk...> - 2002-08-23 14:59:58
|
public java.io.File alt.java.io.File.getRealFile(); Was that the question? On Fri, 2002-08-23 at 00:22, Tim Mackinnon wrote: > Guys - I don't understand how alt.java.io.File (the interface that sun > should have used in the first place) helps us mock stuff up? > > I must be missing something very obvious - but if I have a MockFile that > conforms to that interface, I can't use it with Sun's FileReader object > which expects a java.io.File (there is a basic type difference problem > here). > > So I guess I don't understand the point of it??? At connextra we have > subclassed things like java.io.Reader (as we did for some of the other io > classes - some of which live in the orginial mockobjects code base), and > have implemented the crucial methods that get it to work as a stub and a > mock. This way a MockReader can be used with a BufferedReader and you can > write relevent tests with it. > > For trickier classes like File - which really seem to require fileDescriptor > objects we have adopted the "SimpleFile" convention, which just wraps File > and just delegates a subset of the most useful methods. This interface also > provides getFile, so that if you do use it at a low level in your code you > can get the File object and pass it to something like an XML Document class > (although we tend to use a MockReader in preference to the real file > anyway). > > Is alt.java.io.File an equivalent to the SimpleFile strategy? It doesn't > seem to be to me - so I am scratching my head trying to understand how its > being used in production code at the moment? > > With regards to some of this stuff, I promise to reintegrate asap to pass on > some of the stuff we have lurking around. Its taken us a long time to get > off visualAge so we can more easily work on open source projects (we are > almost there). > > Tim > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.381 / Virus Database: 214 - Release Date: 02/08/2002 > > > > ------------------------------------------------------- > This sf.net email is sponsored by: OSDN - Tired of that same old > cell phone? Get a new here for FREE! > https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev -- jeff martin information technologist mkodo limited mobile: 44 (0) 78 5547 8331 phone: 44 (0) 20 2226 4545 email: je...@mk... www.mkodo.com |