TrackerImpl implements Tracker { @Override public List<TrackerOperationView> getTrackerOperations( String source, Date fromDate, Date toDate, int limit ) { Preconditions.checkArgument( limit > 0, "Limit must be greater than 0" ); Preconditions.checkArgument( !StringUtils.isBlank( source ), SOURCE_IS_EMPTY_MSG ); Preconditions.checkNotNull( fromDate, "From Date is null" ); Preconditions.checkNotNull( toDate, "To Date is null" ); List<TrackerOperationView> list = new ArrayList<>(); try { if ( identityManager.isAdmin() ) { list = dataService.getTrackerOperations( source, fromDate, toDate, limit ); } else { list = dataService.getRecentUserOperations( source, fromDate, toDate, limit, identityManager.getActiveUser().getId() ); } } catch ( SQLException | JsonSyntaxException ex ) { LOG.error( "Error in getTrackerOperations", ex ); } return list; }  @Override TrackerOperationView getTrackerOperation( String source, UUID operationTrackId ); @Override TrackerOperation createTrackerOperation( String source, String description ); @Override List<TrackerOperationView> getTrackerOperations( String source, Date fromDate, Date toDate, int limit ); @Override List<String> getTrackerOperationSources(); @Override void printOperationLog( String source, UUID operationTrackId, long maxOperationDurationMs ); @Override void setOperationViewState( String source, UUID operationId, boolean display ); @Override void setOperationsViewStates( boolean display ); @Override List<TrackerOperationView> getNotifications(); void init(); void dispose(); void setDaoManager( final DaoManager daoManager ); void setIdentityManager( final IdentityManager identityManager );  }
@Test public void testGetTrackerOperations() throws Exception { tracker.getTrackerOperations( SOURCE, new Date(), new Date(), 1 ); verify( dataService ) .getRecentUserOperations( eq( SOURCE ), isA( Date.class ), isA( Date.class ), anyInt(), anyInt() ); doReturn( true ).when( identityManager ).isAdmin(); tracker.getTrackerOperations( SOURCE, new Date(), new Date(), 1 ); verify( dataService ).getTrackerOperations( eq( SOURCE ), isA( Date.class ), isA( Date.class ), anyInt() ); }