diff --git a/pom.xml b/pom.xml
index bd2735e..5e6753c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,6 +59,21 @@
test-jar
test
+
+ ${spring.groupId}
+ spring-beans
+ test
+
+
+ ${spring.groupId}
+ spring-context
+ test
+
+
+ ${spring.groupId}
+ spring-core
+ test
+
diff --git a/src/test/java/uk/org/iay/incommon/mda/dom/saml/BeansFileTest.java b/src/test/java/uk/org/iay/incommon/mda/dom/saml/BeansFileTest.java
new file mode 100644
index 0000000..4984506
--- /dev/null
+++ b/src/test/java/uk/org/iay/incommon/mda/dom/saml/BeansFileTest.java
@@ -0,0 +1,60 @@
+
+package uk.org.iay.incommon.mda.dom.saml;
+
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.support.GenericApplicationContext;
+import org.springframework.core.io.ClassPathResource;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class BeansFileTest {
+
+ @Test
+ public void testBeans() throws Exception {
+ // Create an application context, which also acts as a bean definition registry
+ final GenericApplicationContext ctx = new GenericApplicationContext();
+
+ // Load bean definitions into the registry
+ final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ctx);
+ xmlReader.loadBeanDefinitions(new ClassPathResource("uk/org/iay/incommon//mda/beans.xml"));
+
+ final String[] defNames = ctx.getBeanDefinitionNames();
+ for (final String defName : defNames) {
+ final BeanDefinition def = ctx.getBeanDefinition(defName);
+
+ // All bean definitions should start with "inc."
+ Assert.assertTrue(defName.startsWith("inc."), "does not start with correct prefix: " + defName);
+
+ // All bean definitions should be abstract
+ Assert.assertTrue(def.isAbstract(), "not abstract: " + defName);
+
+ // Deal with the class name, if the definition has one
+ final String className = def.getBeanClassName();
+ if (className != null) {
+ try {
+ // Check that the class can be loaded
+ Class.forName(className);
+
+ // The name of the class within its package should be included in the bean
+ // name's prefix; there may be more after that
+ final String classLastPart = className.replaceFirst("^.*\\.", "");
+ Assert.assertTrue(defName.startsWith("inc." + classLastPart), "does not start with correct prefix: " + defName);
+
+ // If the class represents a stage, its parent should be the stage parent
+ if (className.endsWith("Stage")) {
+ Assert.assertEquals(def.getParentName(), "inc.stage_parent");
+ }
+ } catch (ClassNotFoundException e) {
+ // Could not load class
+ Assert.fail("could not load class " + className + " for bean " + defName);
+ }
+ }
+ }
+
+ // Refresh the context to process the bean definitions
+ ctx.refresh();
+
+ }
+
+}