2 * Svjatoslav Commons - shared library of common functionality. Author: Svjatoslav Agejenko.
3 * This project is released under Creative Commons Zero (CC0) license.
5 package eu.svjatoslav.commons.file;
7 import org.junit.Assert;
11 import java.io.IOException;
13 public class IOHelperTest {
15 public static final String UTF_8 = "UTF-8";
18 public void testOverwriteFileIfContentDiffers() throws IOException {
19 final File file = new File("overrideTest.txt");
21 Assert.assertTrue(IOHelper.overwriteFileIfContentDiffers(file,
22 "aoa".getBytes(UTF_8)));
24 Assert.assertFalse(IOHelper.overwriteFileIfContentDiffers(file,
25 "aoa".getBytes(UTF_8)));
27 Assert.assertTrue(IOHelper.overwriteFileIfContentDiffers(file,
28 "1234".getBytes(UTF_8)));