Hi All,
I'm trying to unit test services (these are already existing services) and
facing a few challenges. I have a "ProjectService" which extends a
baseService and this base service has another service which is injected
into it.
Interface IProjectService {
Event getEvents(Long key)
}
ProjectService extends BaseSerivce implements IProjectService {
getEvents(Long key) {
clientSession = getClientSession();
}
}
BaseService {
@Inject SessionService sessionService;
public ClientSession getClientSession() {
return sessionService.getClientSession();
}
}
// Test Code //
public class IProjectServiceTest {
protected static Registry registry;
@BeforeClass
public void beforeTest() {
registry = new RegistryBuilder().add(AppModule.class).build();
registry.performRegistryStartup();
}
@Test
public void getEvent() {
IProjectService projectService =
registry.getService(IProjectService.class);
Event event = projectService.getEvent(null);
Assert.assertEquals(event, null);
}
}
// End ///
I'm trying to test this using testng and when i try to run this i get an
exception in AppModule
FAILED CONFIGURATION: @BeforeClass beforeTest
java.lang.IllegalArgumentException: Contribution
.wp.services.AppModule.CacheManagerCreator(MappedConfiguration) (at
AppModule.java:260) is for service 'interface
org.apache.tapestry5.services.ApplicationStateManager' qualified with
marker annotations [], which does not exist.
and if i extend IprojectServiceTest with "extend TapestryTestCase" then the
exception is
FAILED CONFIGURATION: @BeforeClass beforeTest
java.lang.IllegalArgumentException: Contribution
wp.services.AppModule.contributeComponentRequestHandler(OrderedConfiguration)
(at AppModule.java:108) is for service 'ComponentRequestHandler', which
does not exist.
I just need to get the clientSession to get my event from a server call.
Thanks in advance,