Search in sources :

Example 1 with Assertions

use of org.junit.jupiter.api.Assertions in project java-design-patterns by iluwatar.

the class SimpleFileWriterTest method testWriterNotNull.

/**
 * Verify if the given writer is not 'null'
 */
@Test
public void testWriterNotNull() throws Exception {
    final File temporaryFile = this.testFolder.newFile();
    new SimpleFileWriter(temporaryFile.getPath(), Assertions::assertNotNull);
}
Also used : File(java.io.File) Assertions(org.junit.jupiter.api.Assertions) Test(org.junit.jupiter.api.Test)

Example 2 with Assertions

use of org.junit.jupiter.api.Assertions in project java-design-patterns by iluwatar.

the class SimpleFileWriterTest method testNonExistentFile.

/**
 * Test if the {@link SimpleFileWriter} creates a file if it doesn't exist
 */
@Test
public void testNonExistentFile() throws Exception {
    final File nonExistingFile = new File(this.testFolder.getRoot(), "non-existing-file");
    assertFalse(nonExistingFile.exists());
    new SimpleFileWriter(nonExistingFile.getPath(), Assertions::assertNotNull);
    assertTrue(nonExistingFile.exists());
}
Also used : File(java.io.File) Assertions(org.junit.jupiter.api.Assertions) Test(org.junit.jupiter.api.Test)

Aggregations

File (java.io.File)2 Assertions (org.junit.jupiter.api.Assertions)2 Test (org.junit.jupiter.api.Test)2