From a7ab3ea4d83bc8b7d38dc602658494033343086b Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Sat, 28 Mar 2015 17:07:44 +0100 Subject: [PATCH] Remove unnecesary componentIsNull methods --- test/poodinis/autowiretest.d | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/test/poodinis/autowiretest.d b/test/poodinis/autowiretest.d index b810600..f548b03 100644 --- a/test/poodinis/autowiretest.d +++ b/test/poodinis/autowiretest.d @@ -14,10 +14,6 @@ version(unittest) { class ComponentB { public @Autowire ComponentA componentA; - - public bool componentIsNull() { - return componentA is null; - } } interface InterfaceA {} @@ -26,10 +22,6 @@ version(unittest) { class ComponentD { public @Autowire InterfaceA componentC = null; - - public bool componentIsNull() { - return componentC is null; - } } class DummyAttribute{}; @@ -73,7 +65,7 @@ version(unittest) { container.register!ComponentA; auto componentB = new ComponentB(); container.autowire!(ComponentB)(componentB); - assert(!componentB.componentIsNull(), "Autowirable dependency failed to autowire"); + assert(componentB !is null, "Autowirable dependency failed to autowire"); } // Test autowiring interface type to existing instance @@ -82,7 +74,7 @@ version(unittest) { container.register!(InterfaceA, ComponentC); auto componentD = new ComponentD(); container.autowire!(ComponentD)(componentD); - assert(!componentD.componentIsNull(), "Autowirable dependency failed to autowire"); + assert(componentD.componentC !is null, "Autowirable dependency failed to autowire"); } // Test autowiring will only happen once @@ -159,6 +151,6 @@ version(unittest) { auto registration = new AutowiredRegistration!ComponentB(typeid(ComponentB), container).singleInstance(); auto instance = cast(ComponentB) registration.getInstance(new AutowireInstantiationContext()); - assert(!instance.componentIsNull()); + assert(instance.componentA !is null); } }