Browse Source

add writeFile storage method

feature-add-storage-class
binsky 3 years ago
parent
commit
c3a4d47d30
  1. 7
      src/main/java/Storage.java
  2. 15
      src/test/java/StorageTest.java

7
src/main/java/Storage.java

@ -8,4 +8,11 @@ public class Storage implements StorageInterface{
public void load() { public void load() {
} }
public boolean writeFile(String path, String content) {
if (!path.isEmpty() && !content.isEmpty()) {
return true;
}
return false;
}
} }

15
src/test/java/StorageTest.java

@ -1,12 +1,20 @@
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*; import static org.junit.jupiter.api.Assertions.*;
class StorageTest { class StorageTest {
static Storage storage;
@BeforeAll
static void init() {
storage = new Storage();
}
@Test @Test
void constructor() { void constructor() {
assertInstanceOf(Storage.class, new Storage());
assertInstanceOf(Storage.class, storage);
} }
@Test @Test
@ -16,4 +24,9 @@ class StorageTest {
@Test @Test
void load() { void load() {
} }
@Test
void writeFile() {
assertTrue(storage.writeFile("/tmp/test.txt", "test"));
}
} }
Loading…
Cancel
Save