mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-05-03 12:29:44 +01:00
Changed use of AssertThrows to @Test(expected = ...)
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@239 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
+14
-13
@@ -16,19 +16,21 @@
|
|||||||
|
|
||||||
package org.springframework.core.io;
|
package org.springframework.core.io;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import org.springframework.test.AssertThrows;
|
|
||||||
|
|
||||||
import java.beans.PropertyEditor;
|
import java.beans.PropertyEditor;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the {@link ResourceEditor} class.
|
* Unit tests for the {@link ResourceEditor} class.
|
||||||
*
|
*
|
||||||
* @author Rick Evans
|
* @author Rick Evans
|
||||||
|
* @author Arjen Poutsma
|
||||||
*/
|
*/
|
||||||
public final class ResourceEditorTests extends TestCase {
|
public final class ResourceEditorTests {
|
||||||
|
|
||||||
public void testSunnyDay() throws Exception {
|
@Test
|
||||||
|
public void sunnyDay() throws Exception {
|
||||||
PropertyEditor editor = new ResourceEditor();
|
PropertyEditor editor = new ResourceEditor();
|
||||||
editor.setAsText("classpath:org/springframework/core/io/ResourceEditorTests.class");
|
editor.setAsText("classpath:org/springframework/core/io/ResourceEditorTests.class");
|
||||||
Resource resource = (Resource) editor.getValue();
|
Resource resource = (Resource) editor.getValue();
|
||||||
@@ -36,21 +38,20 @@ public final class ResourceEditorTests extends TestCase {
|
|||||||
assertTrue(resource.exists());
|
assertTrue(resource.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCtorWithNullResourceLoader() throws Exception {
|
@Test(expected = IllegalArgumentException.class)
|
||||||
new AssertThrows(IllegalArgumentException.class) {
|
public void ctorWithNullResourceLoader() throws Exception {
|
||||||
public void test() throws Exception {
|
new ResourceEditor(null);
|
||||||
new ResourceEditor(null);
|
|
||||||
}
|
|
||||||
}.runTest();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSetAndGetAsTextWithNull() throws Exception {
|
@Test
|
||||||
|
public void setAndGetAsTextWithNull() throws Exception {
|
||||||
PropertyEditor editor = new ResourceEditor();
|
PropertyEditor editor = new ResourceEditor();
|
||||||
editor.setAsText(null);
|
editor.setAsText(null);
|
||||||
assertEquals("", editor.getAsText());
|
assertEquals("", editor.getAsText());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSetAndGetAsTextWithWhitespaceResource() throws Exception {
|
@Test
|
||||||
|
public void setAndGetAsTextWithWhitespaceResource() throws Exception {
|
||||||
PropertyEditor editor = new ResourceEditor();
|
PropertyEditor editor = new ResourceEditor();
|
||||||
editor.setAsText(" ");
|
editor.setAsText(" ");
|
||||||
assertEquals("", editor.getAsText());
|
assertEquals("", editor.getAsText());
|
||||||
|
|||||||
Reference in New Issue
Block a user