Skip to content

Commit ba4c759

Browse files
author
Lukasz Rys
committed
[ BAEL-3322 ] : Change method test names
1 parent e6ff0cd commit ba4c759

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

testing-modules/mocks/src/test/java/com/baeldung/jimfs/FileManipulationUnitTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ private static Stream<Arguments> provideFileSystem() {
2424
}
2525

2626
@ParameterizedTest
27-
@DisplayName("Should create a file on a file system")
27+
@DisplayName("Should move file to new destination")
2828
@MethodSource("provideFileSystem")
29-
void shouldCreateFile(final FileSystem fileSystem) throws Exception {
29+
void givenEachSystem_whenMovingFile_thenMovedToNewPath(final FileSystem fileSystem) throws Exception {
3030
final Path origin = fileSystem.getPath(RESOURCE_FILE_NAME);
3131
Files.copy(getResourceFilePath(), origin);
3232
final Path destination = fileSystem.getPath("newDirectory", RESOURCE_FILE_NAME);

testing-modules/mocks/src/test/java/com/baeldung/jimfs/FilePathReaderUnitTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class FilePathReaderUnitTest {
1919

2020
@Test
2121
@DisplayName("Should get path on windows")
22-
void shouldGetPath_onWindows() throws Exception {
22+
void givenWindowsSystem_shouldGetPath_thenReturnWindowsPath() throws Exception {
2323
final FileSystem fileSystem = Jimfs.newFileSystem(Configuration.windows());
2424
final Path path = getPathToFile(fileSystem);
2525

@@ -30,7 +30,7 @@ void shouldGetPath_onWindows() throws Exception {
3030

3131
@Test
3232
@DisplayName("Should get path on unix")
33-
void shouldGetPath_onUnix() throws Exception {
33+
void givenUnixSystem_shouldGetPath_thenReturnUnixPath() throws Exception {
3434
final FileSystem fileSystem = Jimfs.newFileSystem(Configuration.unix());
3535
final Path path = getPathToFile(fileSystem);
3636

testing-modules/mocks/src/test/java/com/baeldung/jimfs/FileRepositoryUnitTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class FileRepositoryUnitTest implements FileTestProvider {
1717

1818
@Test
1919
@DisplayName("Should create a file on a file system")
20-
void shouldCreateFile() {
20+
void givenUnixSystem_whenCreatingFile_thenCreatedInPath() {
2121
final FileSystem fileSystem = Jimfs.newFileSystem(Configuration.unix());
2222
final String fileName = "newFile.txt";
2323
final Path pathToStore = fileSystem.getPath("");
@@ -29,7 +29,7 @@ void shouldCreateFile() {
2929

3030
@Test
3131
@DisplayName("Should read the content of the file")
32-
void shouldReadFileContent_thenReturnIt() throws Exception {
32+
void givenOSXSystem_whenReadingFile_thenContentIsReturned() throws Exception {
3333
final FileSystem fileSystem = Jimfs.newFileSystem(Configuration.osX());
3434
final Path resourceFilePath = fileSystem.getPath(RESOURCE_FILE_NAME);
3535
Files.copy(getResourceFilePath(), resourceFilePath);
@@ -41,7 +41,7 @@ void shouldReadFileContent_thenReturnIt() throws Exception {
4141

4242
@Test
4343
@DisplayName("Should update the content of the file")
44-
void shouldUpdateContentOfTheFile() throws Exception {
44+
void givenWindowsSystem_whenUpdatingFile_thenContentHasChanged() throws Exception {
4545
final FileSystem fileSystem = Jimfs.newFileSystem(Configuration.windows());
4646
final Path resourceFilePath = fileSystem.getPath(RESOURCE_FILE_NAME);
4747
Files.copy(getResourceFilePath(), resourceFilePath);
@@ -55,7 +55,7 @@ void shouldUpdateContentOfTheFile() throws Exception {
5555

5656
@Test
5757
@DisplayName("Should delete file")
58-
void shouldDeleteFile() throws Exception {
58+
void givenRandomSystem_whenDeletingFile_thenFileHasBeenDeleted() throws Exception {
5959
final FileSystem fileSystem = Jimfs.newFileSystem();
6060
final Path resourceFilePath = fileSystem.getPath(RESOURCE_FILE_NAME);
6161
Files.copy(getResourceFilePath(), resourceFilePath);

0 commit comments

Comments
 (0)