Skip to content

Commit 9abb68e

Browse files
committed
Fix inconsistency with imports in Locker tests
https://build.spring.io/browse/INT-SI51X-93/
1 parent d8dd56d commit 9abb68e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

spring-integration-file/src/test/java/org/springframework/integration/file/locking/FileChannelCacheTests.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727

2828
/**
2929
* @author Emmanuel Roux
30+
* @author Artem Bilan
31+
*
3032
* @since 4.3.22
3133
*/
3234
public class FileChannelCacheTests {
@@ -35,7 +37,7 @@ public class FileChannelCacheTests {
3537
public TemporaryFolder temp = new TemporaryFolder();
3638

3739
@Test
38-
public void throwsExceptionWhenFileNotExists() throws IOException {
40+
public void noLockWhenFileNotExists() throws IOException {
3941
File testFile = new File(temp.getRoot(), "test0");
4042
assertThat(testFile.exists()).isFalse();
4143
assertThat(FileChannelCache.tryLockFor(testFile)).isNull();
@@ -45,7 +47,6 @@ public void throwsExceptionWhenFileNotExists() throws IOException {
4547
@Test
4648
public void fileLocked() throws IOException {
4749
File testFile = temp.newFile("test1");
48-
testFile.createNewFile();
4950
assertThat(testFile.exists()).isTrue();
5051
assertThat(FileChannelCache.tryLockFor(testFile)).isNotNull();
5152
FileChannelCache.closeChannelFor(testFile);

spring-integration-file/src/test/java/org/springframework/integration/file/locking/NioFileLockerTests.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.integration.file.locking;
1818

1919
import static org.hamcrest.CoreMatchers.is;
20+
import static org.junit.Assert.assertFalse;
2021
import static org.junit.Assert.assertThat;
2122
import static org.junit.Assert.assertTrue;
2223

@@ -37,6 +38,7 @@
3738
* @author Iwein Fuld
3839
* @author Gary Russell
3940
* @author Emmanuel Roux
41+
* @author Artem Bilan
4042
*/
4143
public class NioFileLockerTests {
4244

@@ -84,16 +86,16 @@ public void fileLockedWhenNotAlreadyLockedAndExists() throws IOException {
8486
NioFileLocker locker = new NioFileLocker();
8587
File testFile = new File(workdir, "test2");
8688
testFile.createNewFile();
87-
assertThat(locker.lock(testFile)).isTrue();
89+
assertTrue(locker.lock(testFile));
8890
locker.unlock(testFile);
8991
}
9092

9193
@Test
92-
public void fileNotLockedWhenNotExists() throws IOException {
94+
public void fileNotLockedWhenNotExists() {
9395
NioFileLocker locker = new NioFileLocker();
9496
File testFile = new File(workdir, "test3");
95-
assertThat(locker.lock(testFile)).isFalse();
96-
assertThat(testFile.exists()).isFalse();
97+
assertFalse(locker.lock(testFile));
98+
assertFalse(testFile.exists());
9799
}
98100

99101
}

0 commit comments

Comments
 (0)