Hi Matt,

I replaced the BeanUtils.copyProperties(map, obj) in BaseDaoTestCase to
org.apache.commons.beanutils.BeanUtils.copyProperties(obj, map)
and the populate from properties files works like a charm.

Insight gathered from this thread
http://www.nabble.com/NullPointerException-when-trying-to-populate-in-test-case-tf3604674s2369.html#a10227835

/Fadhli

On 7/17/07, fadhli <[EMAIL PROTECTED]> wrote:

No, it's in the same directory as in the test class I created.

Upon further debugging the BaseDaoTestCase,  I found out that the
BeansUtil is not copying the map object into the target object and I have no
idea why. I haven't use BeansUtil before so I'm not sure what's wrong.



On 7/17/07, Matt Raible < [EMAIL PROTECTED]> wrote:
>
> Is your properties file in src/test/resources?
>
>
> On 7/16/07, fadhli <[EMAIL PROTECTED]> wrote:
> > Hi everyone,
> >
> > I have a problem where the test *.properties file is not being copied
> to the
> > test-class target folder. I really appreciate if someone has done
> testing
> > using the populate method from the BaseDaoTestCase and how you got it
> to
> > work.
> >
> > FYI, I'm using Appfuse 2.0-m5 but only the core package with
> full-source
> > files. The following is the error stacktrace from my test case.If I
> manually
> > copy the BrandModelDaoTest.properties file to the test-class target
> folder,
> > the test pass.
> >
> > Thanks in advance.
> >
> > /Fadhli
> >
> > Test set: com.dntmiti.dao.BrandModelDaoTest
> >
> 
-------------------------------------------------------------------------------
>
> > Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.547sec
> > <<< FAILURE!
> > testAddAndRemoveBrandModel(com.dntmiti.dao.BrandModelDaoTest)  Time
> elapsed:
> > 0.031 sec  <<< ERROR!
> > java.lang.NullPointerException
> >     at com.dntmiti.dao.BaseDaoTestCase.populate(BaseDaoTestCase.java
> :58)
> >     at com.dntmiti.dao.BrandModelDaoTest.testAddAndRemoveBrandModel(
> > BrandModelDaoTest.java :61)
> >     at com.dntmiti.dao.BrandModelDaoTest.testAddAndRemoveBrandModel(
> > FPBrandModelDaoTest.java:61)
> >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >     at sun.reflect.NativeMethodAccessorImpl.invoke (
> > NativeMethodAccessorImpl.java:39)
> >     at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> > DelegatingMethodAccessorImpl.java:25)
> >     at java.lang.reflect.Method.invoke(Method.java:585)
> >
> > --
> > /fadhli
> >
>
>
> --
> http://raibledesigns.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
/fadhli




--
/fadhli

Reply via email to