|
|
@ -7,20 +7,22 @@ import java.io.ByteArrayOutputStream; |
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
import java.util.NoSuchElementException; |
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
|
|
public class VaultTest { |
|
|
|
|
|
|
|
static Vault vlt; |
|
|
|
Vault vlt = new Vault(); |
|
|
|
|
|
|
|
@BeforeAll |
|
|
|
/* @BeforeAll |
|
|
|
static void init() { |
|
|
|
vlt = new Vault(); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
/* @BeforeEach |
|
|
|
@BeforeEach |
|
|
|
void reset() { |
|
|
|
pm.outputStream = System.out; |
|
|
|
pm.inputStream = System.in; |
|
|
|
}*/ |
|
|
|
vlt.outputS = System.out; |
|
|
|
vlt.inputS = System.in; |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void configure() {vlt.configure();} |
|
|
@ -37,4 +39,17 @@ public class VaultTest { |
|
|
|
@Test |
|
|
|
void loadFromJson() {vlt.loadFromJson();} |
|
|
|
|
|
|
|
@Test |
|
|
|
void openConfigureMenu() { |
|
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
|
vlt.inputS = getEmptyStringInputStream(); |
|
|
|
vlt.outputS = outputStream; |
|
|
|
vlt.configure(); |
|
|
|
assertTrue(outputStream.toString().startsWith("Configure:")); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private ByteArrayInputStream getEmptyStringInputStream() { |
|
|
|
return new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); |
|
|
|
} |
|
|
|
} |