In case someone else is in this same problem, thanks to Igor for the
solution:
PD: the test is still without content, only the scheleton, but it works!
I have a lot of work now, I do not manage very well with mocks :o)
package xxxxxxxx.biz;
import static org.easymock.EasyMock.createMock;
import java.util.List;
import org.apache.tapestry5.ioc.test.TestUtils;
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import xxxxxxx.dao.IOrganizationDAO;
import xxxxxxx.entities.Organization;
public class PacoServiceTest {
private static IPacoService psrv;
private IOrganizationDAO daomock;
@BeforeClass
public void setUp() {
psrv = new PacoService();
daomock = createMock(IOrganizationDAO.class);
psrv = TestUtils.create(PacoService.class, "orgDao", daomock);
}
@Test(enabled = true)
public void testGetAllOrganizations() {
List<Organization> result = psrv.getAllOrganizations();
AssertJUnit.assertNull(result);
}
@Test(enabled = false)
public void testOrganizationPersist() {
AssertJUnit.fail("Not yet implemented");
}
@Test(enabled = false)
public void testDeleteOrganization() {
AssertJUnit.fail("Not yet implemented");
}
}
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/How-to-inject-a-mock-into-a-tapestry-service-tp4768327p4771774.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]