From 1d9d3e6ff79ce9f0eca03b02cd1df705925575da Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Mon, 13 Feb 2012 15:47:31 +0100 Subject: [PATCH] Fix false negative test failure in ResourceTests Prior to changes in commit 57851de88e84006afc104c4f22eb2fbaf2e0d3d1, 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 --- .../org/springframework/core/io/ResourceTests.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/org.springframework.core/src/test/java/org/springframework/core/io/ResourceTests.java b/org.springframework.core/src/test/java/org/springframework/core/io/ResourceTests.java index 97e498bfbdd2..86c0043d401f 100644 --- a/org.springframework.core/src/test/java/org/springframework/core/io/ResourceTests.java +++ b/org.springframework.core/src/test/java/org/springframework/core/io/ResourceTests.java @@ -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()); } }