added test for GetObject() behavior

This commit is contained in:
eeichinger
2008-12-12 16:07:16 +00:00
parent 4ce925cb86
commit 2199a2b073

View File

@@ -117,6 +117,17 @@ namespace Spring.Context.Support
Assert.IsTrue(ctx.ContainsObject("GORAN"));
Assert.AreEqual(ctx.GetObject("goran"), ctx.GetObject("GORAN"));
}
[Test]
[ExpectedException(typeof(NoSuchObjectDefinitionException))]
public void GetObjectOnUnknownIdThrowsNoSuchObjectDefinition()
{
XmlApplicationContext ctx =
new XmlApplicationContext(false, "assembly://Spring.Core.Tests/Spring.Context.Support/objects.xml");
string DOES_NOT_EXIST = "does_not_exist";
Assert.IsFalse(ctx.ContainsObject(DOES_NOT_EXIST));
Assert.IsNull(ctx.GetObject(DOES_NOT_EXIST));
}
[Test]
public void FactoryObjectsAreNotInstantiatedBeforeObjectFactoryPostProcessorsAreApplied()