I've tried both. In my IDE I'm using IntelliJ IDEA's maven support (utilizing
an external maven client). I've also tried the build via the command line
tool and maven 2.0.7.
For a bit more context, here's the error:
testHandleRequest(gov.nysed.archives.Nimbus.webapp.controller.FindingAidControllerTest)
Time elapsed: 12.188 sec <<< ERROR!
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name
'gov.nysed.archives.Nimbus.webapp.controller.FindingAidControllerTest':
Unsatisfied dependency expressed through bean property 'c': Set this
property value or disable dependency checking for this bean.
Here's part of my dispatcher-servlet.xml that's located in
/src/main/webapp/WEB-INF:
<!-- Add additional controller beans here -->
<bean id="findingAidController"
class="gov.nysed.archives.Nimbus.webapp.controller.FindingAidController">
<property name="findingAidManager" ref="findingAidManager"/>
</bean>
and here's the unit test:
public class FindingAidControllerTest extends BaseControllerTestCase {
private FindingAidController c;
public void setC(FindingAidController c) {
this.c = c;
}
public void testHandleRequest() throws Exception {
ModelAndView mav = c.handleRequest(null, null);
ModelMap m = mav.getModelMap();
assertNotNull(m.get("findingAidList"));
assertTrue(((List) m.get("findingAidList")).size() > 0);
}
}
mraible wrote:
>
> Are you running your tests from an IDE or from the command line? They
> should work from the command line. If you're seeing this in your IDE,
> you may have to change some settings.
>
> Matt
>
> On Jan 10, 2008, at 11:52 AM, Colin Miller wrote:
>
>> I'm having some difficulty with my unit tests in appfuse. I have a
>> manager test that extends BaseManagerTestCase and uses a Manager
>> bean defined in /src/main/webapp/WEB-INF/applicationContext.xml.
>> When I try to run the unit test, I receive an error:
>>
>> Unsatisfied dependency expressed trhough bean property.
>>
>> This is the same error that I receive before adding the bean
>> definition into applicationContext.xml. I have found though that
>> if I move the appliationContext.xml file from /src/main/webapp/WEB-
>> INF/ to /src/main/resources that my unit tests can find it
>> perfectly. I'm running into the same issue with dispatcher-
>> servlet.xml in /src/main/webapp/WEB-INF with my unit test that
>> extends BaseControllerTestCase, so it seems like jUnit tests are
>> not able to find the xml files in WEB-INF.
>>
>> Is there a way to fix this through modifying the getConfigLocations
>> on those base classes? Should I just move these xml files into the
>> resources directory? I've been basically following the tutorial for
>> now, so I was trying to leave them in WEB-INF as it stated. I'm
>> using the regular SpringMVC AppFuse setup (not modular).
>>
>> Thanks for any advice.
>> ~Colin
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/applicationContext-files-in-unit-tests-tp14741480s2369p14754999.html
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]