@Test
public void testCreateOrUpdateFile()
    throws IOException
{

    final String fileAbsPath = FilenameUtils.concat( tmpDir, this.getDateTimeInMillis() + ".txt" );
    String fileContent = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed id ne cogitari quidem "
        + "potest quale sit, ut non repugnet ipsum sibi. Ita multa dicunt, quae vix intellegam. Quamquam "
        + "id quidem, infinitum est in hac urbe; Primum quid tu dicis breve? Aliis esse maiora, illud dubium,"
        + " ad id, quod summum bonum dicitis, ecquaenam possit fieri accessio. Quamquam tu hanc copiosiorem"
        + " etiam soles dicere.\n";
    // test file does not exist and is created.
    assertFalse( FileUtil.isFileExists( fileAbsPath ) );
    boolean created = FileUtil.createOrUpdateFile( fileAbsPath, fileContent );
    assertTrue( created );
    assertTrue( FileUtil.isFileExists( fileAbsPath ) );
    // test that if file exists already, its been updated.
    String fileContent2 = "File updated.";
    boolean updated = FileUtil.createOrUpdateFile( fileAbsPath, fileContent2 );
    assertTrue( updated );
    List<String> lines = Files.readAllLines( Paths.get( fileAbsPath ), StandardCharsets.UTF_8 );
    String text = lines.toString();
    assertFalse( text.contains( fileContent ) );
    assertTrue( text.contains( fileContent2 ) );
    assertTrue( FileUtil.deleteFile( fileAbsPath ) );
}