Skip to content

Commit 9f75849

Browse files
committed
Sort members
1 parent f76ee12 commit 9f75849

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/main/java/org/apache/commons/io/channels/CloseShieldChannelHandler.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ final class CloseShieldChannelHandler implements InvocationHandler {
5656
SUPPORTED_INTERFACES = Collections.unmodifiableSet(interfaces);
5757
}
5858

59-
static boolean isSupported(final Class<?> interfaceClass) {
60-
return SUPPORTED_INTERFACES.contains(interfaceClass);
61-
}
62-
6359
/**
6460
* Tests whether the given method is allowed to be called after the shield is closed.
6561
*
@@ -73,6 +69,10 @@ private static boolean isAllowedAfterClose(final Class<?> declaringClass, final
7369
return parameterCount == 0 && name.equals("supportedOptions") && NetworkChannel.class.equals(declaringClass);
7470
}
7571

72+
static boolean isSupported(final Class<?> interfaceClass) {
73+
return SUPPORTED_INTERFACES.contains(interfaceClass);
74+
}
75+
7676
/**
7777
* Tests whether the given method returns 'this' (the channel) as per JDK spec.
7878
*

src/test/java/org/apache/commons/io/channels/CloseShieldChannelTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,17 +126,6 @@ void testCloseIsShielded(final Class<? extends Channel> channelInterface) throws
126126
verify(channel, times(2)).isOpen();
127127
}
128128

129-
@Test
130-
void testWrapFileChannel(final @TempDir Path tempDir) throws IOException {
131-
final Path testFile = tempDir.resolve("test.txt");
132-
FileUtils.touch(testFile.toFile());
133-
try (FileChannel channel = FileChannel.open(testFile); Channel shield = CloseShieldChannel.wrap(channel)) {
134-
fileChannelInterfaces().forEach(iface -> assertInstanceOf(iface, shield));
135-
// FileChannel is not an interface, so can not be implemented.
136-
assertFalse(shield instanceof FileChannel, "not FileChannel");
137-
}
138-
}
139-
140129
@Test
141130
void testDoesNotDoubleWrap() {
142131
final ByteChannel channel = mock(ByteChannel.class);
@@ -290,6 +279,17 @@ void testToString(final Class<? extends Channel> channelClass) throws Exception
290279
assertTrue(shieldString.contains("MyChannel"));
291280
}
292281

282+
@Test
283+
void testWrapFileChannel(final @TempDir Path tempDir) throws IOException {
284+
final Path testFile = tempDir.resolve("test.txt");
285+
FileUtils.touch(testFile.toFile());
286+
try (FileChannel channel = FileChannel.open(testFile); Channel shield = CloseShieldChannel.wrap(channel)) {
287+
fileChannelInterfaces().forEach(iface -> assertInstanceOf(iface, shield));
288+
// FileChannel is not an interface, so can not be implemented.
289+
assertFalse(shield instanceof FileChannel, "not FileChannel");
290+
}
291+
}
292+
293293
@Test
294294
void testWritableByteChannelMethods() throws Exception {
295295
final WritableByteChannel channel = mock(WritableByteChannel.class);

0 commit comments

Comments
 (0)