ClassPathResource.isReadable() checks InputStream (for jar directories)
Resource.isReadable() is defined to semantically imply exists() now. Issue: SPR-16832
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -109,6 +109,17 @@ public class ClassPathResourceTests {
|
||||
assertEquals("/test.html", ((ClassPathResource) new ClassPathResource("", getClass()).createRelative("/test.html")).getPath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void directoryNotReadable() {
|
||||
Resource fileDir = new ClassPathResource("org/springframework/core");
|
||||
assertTrue(fileDir.exists());
|
||||
assertFalse(fileDir.isReadable());
|
||||
|
||||
Resource jarDir = new ClassPathResource("reactor/core");
|
||||
assertTrue(jarDir.exists());
|
||||
assertFalse(jarDir.isReadable());
|
||||
}
|
||||
|
||||
|
||||
private void assertDescriptionContainsExpectedPath(ClassPathResource resource, String expectedPath) {
|
||||
Matcher matcher = DESCRIPTION_PATTERN.matcher(resource.getDescription());
|
||||
|
||||
Reference in New Issue
Block a user