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()); } }