Browse Source

add writeFile storage method

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

9
src/main/java/Storage.java

@ -1,4 +1,4 @@
public class Storage implements StorageInterface{
public class Storage implements StorageInterface {
@Override
public void export() {
@ -8,4 +8,11 @@ public class Storage implements StorageInterface{
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 static org.junit.jupiter.api.Assertions.*;
class StorageTest {
static Storage storage;
@BeforeAll
static void init() {
storage = new Storage();
}
@Test
void constructor() {
assertInstanceOf(Storage.class, new Storage());
assertInstanceOf(Storage.class, storage);
}
@Test
@ -16,4 +24,9 @@ class StorageTest {
@Test
void load() {
}
@Test
void writeFile() {
assertTrue(storage.writeFile("/tmp/test.txt", "test"));
}
}
Loading…
Cancel
Save