Menu

Lesson 5, Persistance, Filewriter

Paul
2009-10-12
2013-04-09
  • Paul

    Paul - 2009-10-12

    Hi,

    Firstly, I love the tutorials, and I find them very clear, and 'flawless' would be the only feedback I could give.

    However, just one thing I'm a bit confused about.

    In the following code, in the MyUtilitiesTest.java class, you seems to create a new File called testToSaveString.txt, but in the arguments for the following assertTrue statement, you send the file name testsaveString.txt. Shouldn't this result in the filewrite not being able to save into the file, and result in a false value for result. It comes back as true somehow. Here's the code I'm reffering to;

    File testFile = new File(**"testsaveToString.txt"**);

    testFile.delete();
    assertFalse("File should not exist", testFile.exists());
       
    assertTrue("File should have been saved",
    MyUtilities.saveStringToFile(**"testsavestring.txt"**,
    saveString));

    Apologies if I have overlooked something pretty obvious.

    Thanks

     
  • smer4

    smer4 - 2010-06-07

    no it saves to the END of existant file and then it fails compare strings  ( i v tested it right now)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.