From 7ac0e2ba02eb16fad4dc97236cbef2a1c8c6804c Mon Sep 17 00:00:00 2001 From: David Syer Date: Wed, 18 Nov 2009 07:54:19 +0000 Subject: [PATCH] RESOLVED - issue SPR-6366: Cannot import bean definitions using classpath*: resource location http://jira.springframework.org/browse/SPR-6366 --- .../core/io/ResourceEditorTests.java | 1 + .../ResourceArrayPropertyEditorTests.java | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 org.springframework.core/src/test/java/org/springframework/core/io/support/ResourceArrayPropertyEditorTests.java diff --git a/org.springframework.core/src/test/java/org/springframework/core/io/ResourceEditorTests.java b/org.springframework.core/src/test/java/org/springframework/core/io/ResourceEditorTests.java index 6d04764d566..7a06ab7c1ed 100644 --- a/org.springframework.core/src/test/java/org/springframework/core/io/ResourceEditorTests.java +++ b/org.springframework.core/src/test/java/org/springframework/core/io/ResourceEditorTests.java @@ -29,6 +29,7 @@ import org.junit.Test; * * @author Rick Evans * @author Arjen Poutsma + * @author Dave Syer */ public final class ResourceEditorTests { diff --git a/org.springframework.core/src/test/java/org/springframework/core/io/support/ResourceArrayPropertyEditorTests.java b/org.springframework.core/src/test/java/org/springframework/core/io/support/ResourceArrayPropertyEditorTests.java new file mode 100644 index 00000000000..f386788e51a --- /dev/null +++ b/org.springframework.core/src/test/java/org/springframework/core/io/support/ResourceArrayPropertyEditorTests.java @@ -0,0 +1,33 @@ +package org.springframework.core.io.support; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.springframework.core.io.Resource; + + +public class ResourceArrayPropertyEditorTests { + + private ResourceArrayPropertyEditor editor = new ResourceArrayPropertyEditor(); + + @Test + public void testVanillaResource() throws Exception { + editor.setAsText("classpath:org/springframework/core/io/support/ResourceArrayPropertyEditor.class"); + Resource[] resources = (Resource[]) editor.getValue(); + assertNotNull(resources); + assertTrue(resources[0].exists()); + } + + @Test + public void testPatternResource() throws Exception { + // N.B. this will sometimes fail if you use classpath: instead of classpath*:. + // The result depends on the classpath - if test-classes are segregated from classes + // and they come first on the classpath (like in Maven) then it breaks, if classes + // comes first (like in Spring Build) then it is OK. + editor.setAsText("classpath*:org/springframework/core/io/support/Resource*Editor.class"); + Resource[] resources = (Resource[]) editor.getValue(); + assertNotNull(resources); + assertTrue(resources[0].exists()); + } + +}