@ -93,12 +98,15 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
@@ -93,12 +98,15 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
privateEmployeeemployee;
@Autowired
privatePetpet;
privatePetautowiredPet;
@Inject
privatePetinjectedPet;
@Autowired(required=false)
protectedLongnonrequiredLong;
@Resource()
@Resource
protectedStringfoo;
protectedStringbar;
@ -153,11 +161,14 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
@@ -153,11 +161,14 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
assertNull("The nonrequiredLong field should NOT have been autowired.",this.nonrequiredLong);
assertEquals("The quux field should have been autowired via @Autowired and @Qualifier.","Quux",this.quux);
assertNotNull("The pet field should have been autowired.",this.pet);
assertEquals("Fido",this.pet.getName());
assertNotNull("The pet field should have been autowired.",this.autowiredPet);
assertNotNull("The pet field should have been injected.",this.injectedPet);
assertEquals("Fido",this.autowiredPet.getName());
assertEquals("Fido",this.injectedPet.getName());
assertSame("@Autowired and @Inject pet should be the same object.",this.autowiredPet,this.injectedPet);
}
@Test
@ -176,4 +187,4 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
@@ -176,4 +187,4 @@ public class SpringJUnit4ClassRunnerAppCtxTests implements ApplicationContextAwa
assertEquals("The bar method should have been wired via @Resource.","Bar",this.bar);