On Fri, Mar 29, 2013 at 2:34 PM, Chris Geer <[email protected]> wrote:

> On Fri, Mar 29, 2013 at 10:35 AM, Chris Geer <[email protected]>
> wrote:
>
> > I'll look at it...maybe I broke something.
> >
> >
> > On Fri, Mar 29, 2013 at 10:32 AM, Erin Noe-Payne <
> [email protected]
> > > wrote:
> >
> >> Building rave-core
> >>
> >> Running org.apache.rave.portal.service.impl.DefaultCategoryServiceTest
> >> Tests run: 6, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.009
> sec
> >> <<< FAILURE!
> >> Running org.apache.rave.portal.service.impl.DefaultNewAccountServiceTest
> >> DEBUG: org.apache.rave.portal.service.impl.DefaultNewAccountServiceTest
> -
> >> Expected failure of account creation due to duplicate name
> >> DEBUG: org.apache.rave.portal.service.impl.DefaultNewAccountServiceTest
> -
> >> Expected failure of account creation due to duplicate email
> >>
> >
> Ok, I broke this. I know why it broke but I don't have a good solution to
> make this test viable again so any ideas would be great. The change I made
> was to the DefaultCategoryService to return the category returned from the
> Repository instead of the category passed in. This was done for the major
> reason that previously it was just returning the category passed in which
> didn't have an ID which was a major problem. So now it returns the actual
> saved category with the ID.


> The reason the test broke is because it's testing for all sorts of
> attributes that are set by the service. Under normal circumstances these
> would all be returned from the repository but with the Mock repository it's
> just returning a super basic object. Does anyone know of a way to mock a
> method so I could take in the object passed in, modify it and send it back
> out instead of returning a static object?
>

Look at EasyMock.andAnswer(IAnswer<T> answer);


>
> For now I'm going to comment out the test so that the compile doesn't fail.
>
> Chris
>

Reply via email to