### Question:
ActivityService extends RegistryAbstractAdmin implements IActivityService { public ActivityBean getActivities(String userName, String resourcePath, String fromDate, String toDate, String filter, String pageStr, String sessionId) throws RegistryException { UserRegistry registry = (UserRegistry)getRootRegistry(); try{ return ActivityBeanPopulator.populate(registry, userName, resourcePath, fromDate, toDate, filter, pageStr); } catch(Exception e) { return null; } }  void setSession(String sessionId, HttpSession session); void removeSession(String sessionId); ActivityBean getActivities(String userName, String resourcePath, String fromDate,
                                      String toDate, String filter, String pageStr, String sessionId);  }### Answer:
@Test public void getActivities() throws Exception { ActivityService activityService = new ActivityService(); String username = "admin"; String resourcePath = "/_system/governance/apimgt/application"; String fromDate = "10/10/2016"; String toDate = "10/10/2017"; String filter = "resourceAdd"; String pgStr = null; String sessionId = null; ActivityBean activityBean = activityService.getActivities(username, resourcePath, fromDate, toDate, filter, pgStr, null); String[] activities = activityBean.getActivity(); String errorMessage = activityBean.getErrorMessage(); assertNotNull(activities); assertNull(errorMessage); assertEquals(2, activities.length); }
@Test public void getActivitiesFailure() throws Exception { ActivityService activityService = new ActivityService(); String username = "admin"; String resourcePath = "/_system/governance/apimgt/application"; String fromDate = "10/10/2016"; String toDate = "10/10/2017"; String filter = "all"; String pgStr = null; String sessionId = null; ActivityBean activityBean = activityService.getActivities(username, resourcePath, fromDate, toDate, filter, pgStr, null); assertNull(activityBean); }