diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/locking/FileChannelCacheTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/locking/FileChannelCacheTests.java index 90f9fb23de..03f637a661 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/locking/FileChannelCacheTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/locking/FileChannelCacheTests.java @@ -27,6 +27,8 @@ import org.junit.rules.TemporaryFolder; /** * @author Emmanuel Roux + * @author Artem Bilan + * * @since 4.3.22 */ public class FileChannelCacheTests { @@ -35,7 +37,7 @@ public class FileChannelCacheTests { public TemporaryFolder temp = new TemporaryFolder(); @Test - public void throwsExceptionWhenFileNotExists() throws IOException { + public void noLockWhenFileNotExists() throws IOException { File testFile = new File(temp.getRoot(), "test0"); assertThat(testFile.exists()).isFalse(); assertThat(FileChannelCache.tryLockFor(testFile)).isNull(); @@ -45,7 +47,6 @@ public class FileChannelCacheTests { @Test public void fileLocked() throws IOException { File testFile = temp.newFile("test1"); - testFile.createNewFile(); assertThat(testFile.exists()).isTrue(); assertThat(FileChannelCache.tryLockFor(testFile)).isNotNull(); FileChannelCache.closeChannelFor(testFile); diff --git a/spring-integration-file/src/test/java/org/springframework/integration/file/locking/NioFileLockerTests.java b/spring-integration-file/src/test/java/org/springframework/integration/file/locking/NioFileLockerTests.java index 3e9aa52769..f7492304c4 100644 --- a/spring-integration-file/src/test/java/org/springframework/integration/file/locking/NioFileLockerTests.java +++ b/spring-integration-file/src/test/java/org/springframework/integration/file/locking/NioFileLockerTests.java @@ -17,6 +17,7 @@ package org.springframework.integration.file.locking; import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; @@ -37,6 +38,7 @@ import org.springframework.integration.test.util.TestUtils; * @author Iwein Fuld * @author Gary Russell * @author Emmanuel Roux + * @author Artem Bilan */ public class NioFileLockerTests { @@ -84,16 +86,16 @@ public class NioFileLockerTests { NioFileLocker locker = new NioFileLocker(); File testFile = new File(workdir, "test2"); testFile.createNewFile(); - assertThat(locker.lock(testFile)).isTrue(); + assertTrue(locker.lock(testFile)); locker.unlock(testFile); } @Test - public void fileNotLockedWhenNotExists() throws IOException { + public void fileNotLockedWhenNotExists() { NioFileLocker locker = new NioFileLocker(); File testFile = new File(workdir, "test3"); - assertThat(locker.lock(testFile)).isFalse(); - assertThat(testFile.exists()).isFalse(); + assertFalse(locker.lock(testFile)); + assertFalse(testFile.exists()); } }