This should be easy, but I can't figure how to do this.

I have a service that has a dependency to a DAO, that I manage using injection:

@Inject
private IOrganizationDAO orgDao;

As far as i know, tapestry uses the construction mechanism to injection, so I 
have not a setter, tapestry does this through the constructor of the service.

But now I want to do a unit test of this service, so I need to inject manually 
a mock of the DAO, and I don't know how to do this.
Maybe I have to create a setter for the dependency, but I can't find any 
example or documentation about this.

private static IPacoService psrv;


@Test(enabled = true)
public void testGetAllOrganizations() {
// psrv.orgDao = new mockDAO();  ===> ????
psrv.getAllOrganizations();
// assert goes here
}

Reply via email to