Skip to content

Commit 1d9d3e6

Browse files
committed
Fix false negative test failure in ResourceTests
Prior to changes in commit 57851de, AbstractResource#getFilename threw IllegalStateException unless overridden by a subclass. Following that change, this method now throws null instead, but ResourceTests#testAbstractResourceExceptions had not been updated to reflect, resulting in a false negative failure. This has now been fixed. Issue: SPR-9043
1 parent 8e0b1c3 commit 1d9d3e6

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

org.springframework.core/src/test/java/org/springframework/core/io/ResourceTests.java

+3-7
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.core.io;
1818

19+
import static org.hamcrest.CoreMatchers.nullValue;
1920
import static org.junit.Assert.*;
2021

2122
import java.io.ByteArrayInputStream;
@@ -215,13 +216,8 @@ public InputStream getInputStream() {
215216
catch (FileNotFoundException ex) {
216217
assertTrue(ex.getMessage().indexOf(name) != -1);
217218
}
218-
try {
219-
resource.getFilename();
220-
fail("IllegalStateException should have been thrown");
221-
}
222-
catch (IllegalStateException ex) {
223-
assertTrue(ex.getMessage().indexOf(name) != -1);
224-
}
219+
220+
assertThat(resource.getFilename(), nullValue());
225221
}
226222

227223
}

0 commit comments

Comments
 (0)