Permalink
Browse files

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
  • Loading branch information...
1 parent 8e0b1c3 commit 1d9d3e6ff79ce9f0eca03b02cd1df705925575da @cbeams cbeams committed Feb 13, 2012
@@ -16,6 +16,7 @@
package org.springframework.core.io;
+import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.*;
import java.io.ByteArrayInputStream;
@@ -215,13 +216,8 @@ public InputStream getInputStream() {
catch (FileNotFoundException ex) {
assertTrue(ex.getMessage().indexOf(name) != -1);
}
- try {
- resource.getFilename();
- fail("IllegalStateException should have been thrown");
- }
- catch (IllegalStateException ex) {
- assertTrue(ex.getMessage().indexOf(name) != -1);
- }
+
+ assertThat(resource.getFilename(), nullValue());
}
}

0 comments on commit 1d9d3e6

Please sign in to comment.