I also tried uncommenting it.but it is not working.BEfore that at first When
I tried to run mvn test -Dtest=PersonDaoTest I got the following error
Running org.appfuse.tutorial.dao.PersonDaoTest
[personTestProject] INFO [main] PersonDaoTest.loadContextLocations(210) |
Loading context for locations:
classpath:/applicationContext-resources.xml,classpath:/applicationContext-dao.xml,classpath*:/applicationContext.xml,classpath:**/applicationContext*.xml
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.607 sec
<<< FAILURE!

Results :

Tests in error: 
  testFindPersonByLastName(org.appfuse.tutorial.dao.PersonDaoTest)
  testAddAndRemovePerson(org.appfuse.tutorial.dao.PersonDaoTest)

Tests run: 2, Failures: 0, Errors: 2, Skipped: 0

[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE



So I added the following in my pom.xml and then personDaoTest  was running
correctly.
<plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.1</version>
            </plugin>

But runnning mvn test -Dtest=PersonManagerImplTest is showing the same
previous error.So I Commented the above in my pom.xml and now mvn test
-Dtest=PersonManagerImplTest is running correctly.But while running
 mvn test -Dtest=PersonDaoTest it is showing the same error as above.Is it
any version proble of maven-surefire-plugin.plz help..
THnks Angela


Marc_13 wrote:
> 
> That works for me after uncommenting the following section of the pom:
>     <repositories>
>         <repository>
>             <id>central</id>
>             <url>http://repo1.maven.org/maven2</url>
>         </repository>
>         <repository>
>             <id>appfuse</id>
>             <url>http://static.appfuse.org/repository</url>
>         </repository>
>     </repositories>
> 
>     <pluginRepositories>
>         <pluginRepository>
>             <id>appfuse</id>
>             <url>http://static.appfuse.org/repository</url>
>         </pluginRepository>
>     </pluginRepositories>
> 
> --
> Marc
> 
> 2008/8/28 angela leo <[EMAIL PROTECTED]>
> 
>>
>>  svn checkout http://appfuse-demos.googlecode.com/svn.
>>
>> I run svn checkout http://appfuse-demos.googlecode.com/svn and that
>> version is working.
>> Thanks Angela. But my test is not working.All the test codes are same as
>> in
>> check out version..is it any problem related to pom.xml
>>
>> mraible wrote:
>> >
>> > You might want to try checking out the completed tutorials code to see
>> > if that works for you.
>> >
>> > svn checkout
>> > http://appfuse-demos.googlecode.com/svn/trunk/tutorial-service
>> >
>> > Matt
>> >
>> > On Wed, Aug 27, 2008 at 12:12 AM, angela leo
>> > <[EMAIL PROTECTED]> wrote:
>> >>
>> >>
>> >>  Ya..I included that in PersonManagerImplTest.The the test code for
>> >> PersonManagerImplTest is given below
>> >>
>> >> package org.appfuse.tutorial.service.impl;
>> >> /**
>> >>  * Created by IntelliJ IDEA.
>> >>  */
>> >> import java.util.ArrayList;
>> >> import java.util.List;
>> >> import org.appfuse.tutorial.dao.PersonDao;
>> >> import org.appfuse.tutorial.model.Person;
>> >> import org.appfuse.tutorial.service.impl.PersonManagerImpl;
>> >> import org.appfuse.service.impl.BaseManagerMockTestCase;
>> >> import org.jmock.Expectations;
>> >> import org.junit.Before;
>> >> import org.junit.After;
>> >> import org.junit.Test;
>> >> import static org.junit.Assert.*;
>> >>
>> >> public class PersonManagerImplTest extends BaseManagerMockTestCase {
>> >>    private PersonManagerImpl manager = null;
>> >>    private PersonDao dao = null;
>> >>
>> >>    @Before
>> >>    public void setUp() {
>> >>        dao = context.mock(PersonDao.class);
>> >>        manager = new PersonManagerImpl(dao);
>> >>    }
>> >>
>> >>    @After
>> >>    public void tearDown() {
>> >>        manager = null;
>> >>    }
>> >>
>> >>    @Test
>> >>    public void testGetPerson() {
>> >>        log.debug("testing get...");
>> >>
>> >>        final Long id = 7L;
>> >>        final Person person = new Person();
>> >>
>> >>        // set expected behavior on dao
>> >>        context.checking(new Expectations() {{
>> >>            one(dao).get(with(equal(id)));
>> >>            will(returnValue(person));
>> >>        }});
>> >>
>> >>        Person result = manager.get(id);
>> >>        assertSame(person, result);
>> >>    }
>> >>
>> >>    @Test
>> >>    public void testGetPersons() {
>> >>        log.debug("testing getAll...");
>> >>
>> >>        final List persons = new ArrayList();
>> >>
>> >>        // set expected behavior on dao
>> >>        context.checking(new Expectations() {{
>> >>            one(dao).getAll();
>> >>            will(returnValue(persons));
>> >>        }});
>> >>
>> >>        List result = manager.getAll();
>> >>
>> >>        assertSame(persons, result);
>> >>    }
>> >>
>> >>    @Test
>> >>    public void testSavePerson() {
>> >>        log.debug("testing save...");
>> >>
>> >>        final Person person = new Person();
>> >>        // enter all required fields
>> >>
>> >>        // set expected behavior on dao
>> >>        context.checking(new Expectations() {{
>> >>            one(dao).save(with(same(person)));
>> >>        }});
>> >>
>> >>        manager.save(person);
>> >>    }
>> >>
>> >>    @Test
>> >>    public void testRemovePerson() {
>> >>        log.debug("testing remove...");
>> >>
>> >>        final Long id = -11L;
>> >>
>> >>        // set expected behavior on dao
>> >>        context.checking(new Expectations() {{
>> >>            one(dao).remove(with(equal(id)));
>> >>        }});
>> >>
>> >>        manager.remove(id);
>> >>    }
>> >> }
>> >>
>> >> Thnks
>> >> Angela
>> >>
>> >>
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Re%3A-can-only-set-expectations-on-mock-objects-tp19167715s2369p19175818.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]
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Re%3A-can-only-set-expectations-on-mock-objects-tp19167715s2369p19195386.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]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Re%3A-can-only-set-expectations-on-mock-objects-tp19167715s2369p19196914.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]

Reply via email to