We are using real session in other areas. Only difference is transaction demarcation (therefore in test we can't clear). See my other comment for other option. 

> From: "Sean Flanigan" <notifications@github.com>
> To: "zanata/zanata-server" <zanata-server@noreply.github.com>
> Cc: "Patrick Huang" <pahuang@redhat.com>
> Sent: Wednesday, June 4, 2014 2:10:53 PM
> Subject: Re: [zanata-server] Optimize copytrans (#484)

> In
> zanata-war/src/test/java/org/zanata/service/impl/CopyTransServiceImplTest.java:
> > @@ -198,8 +197,11 @@ public void testCopyTrans(CopyTransExecution
> > execution) {
> >                  new
> >                  HCopyTransOptions(execution.getContextMismatchAction(),
> >                          execution.getDocumentMismatchAction(),
> >                          execution.getProjectMismatchAction());
> > -        CopyTransService copyTransService =
> > -                seam.autowire(CopyTransServiceImpl.class);
> > +        CopyTransServiceImpl copyTransService =
> > +                Mockito.spy(seam.autowire(CopyTransServiceImpl.class));
> > +        // so that we don't call session.clear
> > +        // (because in test transaction is not committed)
> > +
> >        Mockito.doReturn(false).when(copyTransService).isSafeToClearSession();

> What about mocking the Session and its clear method?

> —
> Reply to this email directly or view it on GitHub .