Let me also add the comment that the test will cause an error if one of the
POJO fields is
annotated with "unique = true". That's because onSetUpBeforeTransaction() is
invoked
before each test and hence populates the database with as many additional
objects as
tests exist. 

According to my database, after finishing the tests, all additional objects
are removed from the database. What's the counterpart of
onSetUpBeforeTransaction()?
How does the mechanism work? Will all added objects be removed from the
database after 
finishing the last test?

Martin



chino fish wrote:
> 
> 
> 
> 
> On 5/16/07, chino fish <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>>
>> 1.       the test is function test, not unit test. Isn't it ? b/c it uses
>> real service object, but mock objects.
> 
> Yes.
> 
>>
>> 2.       the method followed is a bit of useless..b/c personManager andd
>> person are not used by other test at all.
> 
> It's used to add at least one record to the database so testSearch()
> doesn't fail.
> 
> Matt
> 
> Oh, that's what I guessed ;-)
> It seems the method should only be called in testSearch method。
> But actually, it is called before every test b/c the code was in method
> onSetupBeforeTransaction which is called by setup method.
> 
> And b/c dbunit plunge some sample data into db, so there is already at
> least
> one record in the table.
> 
>>
>>     protected void onSetUpBeforeTransaction() throws Exception {
>>
>>
>>
>>         super.onSetUpBeforeTransaction();
>>
>>         GenericManager personManager = (GenericManager)
>> applicationContext.getBean("personManager");
>>
>>
>>
>>
>>
>>         // add a test person to the database
>>
>>
>>
>>         Person person = new Person();
>>
>>         person.setFirstName("Jack");
>>
>>
>>
>>         person.setLastName("Raible");
>>
>>
>>
>>         personManager.save(person);
>>
>> }
>>
>>
>>
>> chinofish
> 
> 
> -- 
> http://raibledesigns.com
> 
> ---------------------------------------------------------------------
> 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/Two-questions-about-PersonActionTest-tf3768046s2369.html#a13055042
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to