BAEL-3322: Prettify
This commit is contained in:
@@ -26,7 +26,7 @@ class FileRepositoryUnitTest implements FileTestProvider {
|
|||||||
@DisplayName("Should create a file on a file system")
|
@DisplayName("Should create a file on a file system")
|
||||||
@MethodSource("provideFileSystem")
|
@MethodSource("provideFileSystem")
|
||||||
void shouldCreateFile(final FileSystem fileSystem) throws Exception {
|
void shouldCreateFile(final FileSystem fileSystem) throws Exception {
|
||||||
final String fileName = "test.txt";
|
final String fileName = "newFile.txt";
|
||||||
final Path pathToStore = fileSystem.getPath("");
|
final Path pathToStore = fileSystem.getPath("");
|
||||||
|
|
||||||
fileRepository.create(pathToStore, fileName);
|
fileRepository.create(pathToStore, fileName);
|
||||||
@@ -38,10 +38,10 @@ class FileRepositoryUnitTest implements FileTestProvider {
|
|||||||
@DisplayName("Should read the content of the file")
|
@DisplayName("Should read the content of the file")
|
||||||
@MethodSource("provideFileSystem")
|
@MethodSource("provideFileSystem")
|
||||||
void shouldReadFileContent_thenReturnIt(final FileSystem fileSystem) throws Exception {
|
void shouldReadFileContent_thenReturnIt(final FileSystem fileSystem) throws Exception {
|
||||||
final Path pathToStore = fileSystem.getPath(RESOURCE_FILE_NAME);
|
final Path resourceFilePath = fileSystem.getPath(RESOURCE_FILE_NAME);
|
||||||
Files.copy(getResourceFilePath(), pathToStore);
|
Files.copy(getResourceFilePath(), resourceFilePath);
|
||||||
|
|
||||||
final String content = fileRepository.read(pathToStore);
|
final String content = fileRepository.read(resourceFilePath);
|
||||||
|
|
||||||
assertEquals(FILE_CONTENT, content);
|
assertEquals(FILE_CONTENT, content);
|
||||||
}
|
}
|
||||||
@@ -50,25 +50,25 @@ class FileRepositoryUnitTest implements FileTestProvider {
|
|||||||
@DisplayName("Should update content of the file")
|
@DisplayName("Should update content of the file")
|
||||||
@MethodSource("provideFileSystem")
|
@MethodSource("provideFileSystem")
|
||||||
void shouldUpdateContentOfTheFile(final FileSystem fileSystem) throws Exception {
|
void shouldUpdateContentOfTheFile(final FileSystem fileSystem) throws Exception {
|
||||||
final Path pathToStore = fileSystem.getPath(RESOURCE_FILE_NAME);
|
final Path resourceFilePath = fileSystem.getPath(RESOURCE_FILE_NAME);
|
||||||
Files.copy(getResourceFilePath(), pathToStore);
|
Files.copy(getResourceFilePath(), resourceFilePath);
|
||||||
final String newContent = "NEW_CONTENT";
|
final String newContent = "I'm updating you.";
|
||||||
|
|
||||||
final String content = fileRepository.update(pathToStore, newContent);
|
final String content = fileRepository.update(resourceFilePath, newContent);
|
||||||
|
|
||||||
assertEquals(newContent, content);
|
assertEquals(newContent, content);
|
||||||
assertEquals(newContent, fileRepository.read(pathToStore));
|
assertEquals(newContent, fileRepository.read(resourceFilePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@DisplayName("Should update delete file")
|
@DisplayName("Should update delete file")
|
||||||
@MethodSource("provideFileSystem")
|
@MethodSource("provideFileSystem")
|
||||||
void shouldDeleteFile(final FileSystem fileSystem) throws Exception {
|
void shouldDeleteFile(final FileSystem fileSystem) throws Exception {
|
||||||
final Path pathToStore = fileSystem.getPath(RESOURCE_FILE_NAME);
|
final Path resourceFilePath = fileSystem.getPath(RESOURCE_FILE_NAME);
|
||||||
Files.copy(getResourceFilePath(), pathToStore);
|
Files.copy(getResourceFilePath(), resourceFilePath);
|
||||||
|
|
||||||
fileRepository.delete(pathToStore);
|
fileRepository.delete(resourceFilePath);
|
||||||
|
|
||||||
assertFalse(Files.exists(pathToStore));
|
assertFalse(Files.exists(resourceFilePath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@ import java.nio.file.Path;
|
|||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
public interface FileTestProvider {
|
public interface FileTestProvider {
|
||||||
String FILE_CONTENT = "BAELDUNG";
|
String FILE_CONTENT = "I'm the file content.";
|
||||||
String RESOURCE_FILE_NAME = "fileRepositoryRead.txt";
|
String RESOURCE_FILE_NAME = "fileRepositoryRead.txt";
|
||||||
|
|
||||||
default Path getResourceFilePath() {
|
default Path getResourceFilePath() {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
BAELDUNG
|
I'm the file content.
|
||||||
Reference in New Issue
Block a user