diff --git a/src/main/java/com/rfb/bootstrap/RfbBootstrap.java b/src/main/java/com/rfb/bootstrap/RfbBootstrap.java index ada5775..5cf5f55 100644 --- a/src/main/java/com/rfb/bootstrap/RfbBootstrap.java +++ b/src/main/java/com/rfb/bootstrap/RfbBootstrap.java @@ -14,6 +14,7 @@ import java.time.DayOfWeek; import java.time.LocalDate; import java.util.HashSet; +import java.util.Optional; import java.util.UUID; /** @@ -62,6 +63,10 @@ private void initData() { rfbUser.addAuthority(authorityRepository.findOne("ROLE_ORGANIZER")); userRepository.save(rfbUser); + User runner = Optional.ofNullable( + userRepository.findOneByLogin("runner") + ).orElseThrow(()->new IllegalArgumentException("User runner not found")).get(); + //load data RfbLocation aleAndWitch = getRfbLocation("St Pete - Ale and the Witch", DayOfWeek.MONDAY.getValue()); @@ -71,6 +76,8 @@ private void initData() { RfbEvent aleEvent = getRfbEvent(aleAndWitch); getRfbEventAttendance(rfbUser, aleEvent); + getRfbEventAttendance(rfbUser, aleEvent);// adding two attendance for this user + getRfbEventAttendance(runner, aleEvent);// adding two attendance for this user RfbLocation ratc = getRfbLocation("St Pete - Right Around The Corner", DayOfWeek.TUESDAY.getValue()); diff --git a/src/main/java/com/rfb/service/RfbLocationService.java b/src/main/java/com/rfb/service/RfbLocationService.java index e6d44ff..23daaf4 100644 --- a/src/main/java/com/rfb/service/RfbLocationService.java +++ b/src/main/java/com/rfb/service/RfbLocationService.java @@ -1,9 +1,12 @@ package com.rfb.service; import com.rfb.service.dto.RfbLocationDTO; +import com.rfb.service.dto.location.RfbLeaderForLocationDTO; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import java.util.List; + /** * Service Interface for managing RfbLocation. */ @@ -39,4 +42,6 @@ public interface RfbLocationService { * @param id the id of the entity */ void delete(Long id); + + List getRfbLeaderForLocation(Long locationId); } diff --git a/src/main/java/com/rfb/service/dto/location/RfbLeaderForLocationDTO.java b/src/main/java/com/rfb/service/dto/location/RfbLeaderForLocationDTO.java new file mode 100644 index 0000000..a53202e --- /dev/null +++ b/src/main/java/com/rfb/service/dto/location/RfbLeaderForLocationDTO.java @@ -0,0 +1,40 @@ +package com.rfb.service.dto.location; + +import java.util.Objects; + +public class RfbLeaderForLocationDTO { + + private String userName; + private int totalRuns; + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public int getTotalRuns() { + return totalRuns; + } + + public void setTotalRuns(int totalRuns) { + this.totalRuns = totalRuns; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + RfbLeaderForLocationDTO that = (RfbLeaderForLocationDTO) o; + return getTotalRuns() == that.getTotalRuns() && + Objects.equals(getUserName(), that.getUserName()); + } + + @Override + public int hashCode() { + + return Objects.hash(getUserName(), getTotalRuns()); + } +} diff --git a/src/main/java/com/rfb/service/impl/RfbLocationServiceImpl.java b/src/main/java/com/rfb/service/impl/RfbLocationServiceImpl.java index a088765..ed5d470 100644 --- a/src/main/java/com/rfb/service/impl/RfbLocationServiceImpl.java +++ b/src/main/java/com/rfb/service/impl/RfbLocationServiceImpl.java @@ -1,35 +1,41 @@ package com.rfb.service.impl; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import com.rfb.domain.RfbLocation; +import com.rfb.domain.User; import com.rfb.repository.RfbLocationRepository; import com.rfb.service.RfbLocationService; import com.rfb.service.dto.RfbLocationDTO; +import com.rfb.service.dto.location.RfbLeaderForLocationDTO; import com.rfb.service.mapper.RfbLocationMapper; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.*; + /** * Service Implementation for managing RfbLocation. */ @Service @Transactional -public class RfbLocationServiceImpl implements RfbLocationService{ +public class RfbLocationServiceImpl implements RfbLocationService { private final Logger log = LoggerFactory.getLogger(RfbLocationServiceImpl.class); - private final RfbLocationRepository rfbLocationRepository; + @Autowired + private RfbLocationRepository rfbLocationRepository; - private final RfbLocationMapper rfbLocationMapper; + @Autowired + private RfbLocationMapper rfbLocationMapper; - public RfbLocationServiceImpl(RfbLocationRepository rfbLocationRepository, RfbLocationMapper rfbLocationMapper) { - this.rfbLocationRepository = rfbLocationRepository; - this.rfbLocationMapper = rfbLocationMapper; - } /** * Save a rfbLocation. @@ -46,10 +52,10 @@ public RfbLocationDTO save(RfbLocationDTO rfbLocationDTO) { } /** - * Get all the rfbLocations. + * Get all the rfbLocations. * - * @param pageable the pagination information - * @return the list of entities + * @param pageable the pagination information + * @return the list of entities */ @Override @Transactional(readOnly = true) @@ -60,10 +66,10 @@ public Page findAll(Pageable pageable) { } /** - * Get one rfbLocation by id. + * Get one rfbLocation by id. * - * @param id the id of the entity - * @return the entity + * @param id the id of the entity + * @return the entity */ @Override @Transactional(readOnly = true) @@ -74,13 +80,56 @@ public RfbLocationDTO findOne(Long id) { } /** - * Delete the rfbLocation by id. + * Delete the rfbLocation by id. * - * @param id the id of the entity + * @param id the id of the entity */ @Override public void delete(Long id) { log.debug("Request to delete RfbLocation : {}", id); rfbLocationRepository.delete(id); } + + @Transactional(readOnly = true) + public List getRfbLeaderForLocation(Long locationId) { + if (locationId == null) { + throw new IllegalArgumentException("location id not informed"); + } + RfbLocation location = getOneLocation(locationId); + if (location == null) { + throw new IllegalArgumentException("location id not informed"); + } + + Map userInfoMap = Maps.newHashMap(); + location.getRvbEvents().stream() + .forEach(event -> event.getRfbEventAttendances().stream() + .forEach(evAtt -> { + User user = evAtt.getUser(); + Long userId = user.getId(); + RfbLeaderForLocationDTO dto = userInfoMap.get(userId); + int totalRuns = 1; + if (dto == null) { + dto = new RfbLeaderForLocationDTO(); + String name = user.getFirstName(); + String lastName = user.getLastName(); + if (StringUtils.isNoneBlank(lastName)) { + name = lastName + ", " + name; + } + dto.setUserName(name); + dto.setTotalRuns(totalRuns); + } else { + totalRuns += 1; + } + dto.setTotalRuns(totalRuns); + userInfoMap.put(userId, dto); + })); + List values = Lists.newArrayList(userInfoMap.values()); + Collections.sort(values, Comparator.comparingInt(RfbLeaderForLocationDTO::getTotalRuns)); + Collections.reverse(values); + return values; + } + + protected RfbLocation getOneLocation(Long locationId) { + return rfbLocationRepository.findOne(locationId); + } } diff --git a/src/main/java/com/rfb/web/rest/RfbLocationResource.java b/src/main/java/com/rfb/web/rest/RfbLocationResource.java index 7a3ccdb..d16a132 100644 --- a/src/main/java/com/rfb/web/rest/RfbLocationResource.java +++ b/src/main/java/com/rfb/web/rest/RfbLocationResource.java @@ -3,6 +3,7 @@ import com.codahale.metrics.annotation.Timed; import com.rfb.service.RfbLocationService; import com.rfb.service.dto.RfbLocationDTO; +import com.rfb.service.dto.location.RfbLeaderForLocationDTO; import com.rfb.web.rest.util.HeaderUtil; import com.rfb.web.rest.util.PaginationUtil; import io.github.jhipster.web.util.ResponseUtil; @@ -122,4 +123,12 @@ public ResponseEntity deleteRfbLocation(@PathVariable Long id) { rfbLocationService.delete(id); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build(); } + + @Timed + @GetMapping("/rfb-locations/{id}/leaders") + public ResponseEntity> getRfbLeaderForLocation(@PathVariable Long id) { + log.debug("REST request to get RfbLocation : {}", id); + List rfbLocationDTO = rfbLocationService.getRfbLeaderForLocation(id); + return new ResponseEntity<>(rfbLocationDTO, HttpStatus.OK); + } } diff --git a/src/main/resources/.h2.server.properties b/src/main/resources/.h2.server.properties index 3237d14..a38b72f 100644 --- a/src/main/resources/.h2.server.properties +++ b/src/main/resources/.h2.server.properties @@ -1,6 +1,6 @@ #H2 Server Properties -#Sat Nov 04 14:07:31 EDT 2017 -0=JHipster H2 (Memory)|org.h2.Driver|jdbc\:h2\:mem\:rfbloyalty|rfbloyalty +#Fri May 25 14:37:31 BRT 2018 +0=JHipster H2 (Memory)|org.h2.Driver|jdbc\:h2\:file\:~/temp/dabases/rfbloyalty/rfbloyalty|rfbloyalty webAllowOthers=true webPort=8082 webSSL=false diff --git a/src/main/webapp/app/app.module.ts b/src/main/webapp/app/app.module.ts index b0b65d9..86f0ec7 100644 --- a/src/main/webapp/app/app.module.ts +++ b/src/main/webapp/app/app.module.ts @@ -1,30 +1,29 @@ import './vendor.ts'; -import { NgModule } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; -import { Ng2Webstorage } from 'ng2-webstorage'; +import {NgModule} from '@angular/core'; +import {BrowserModule} from '@angular/platform-browser'; +import {Ng2Webstorage} from 'ng2-webstorage'; -import { RfbloyaltySharedModule, UserRouteAccessService } from './shared'; -import { RfbloyaltyHomeModule } from './home/home.module'; -import { RfbloyaltyAdminModule } from './admin/admin.module'; -import { RfbloyaltyAccountModule } from './account/account.module'; -import { RfbloyaltyEntityModule } from './entities/entity.module'; - -import { customHttpProvider } from './blocks/interceptor/http.provider'; -import { PaginationConfig } from './blocks/config/uib-pagination.config'; - -// jhipster-needle-angular-add-module-import JHipster will add new module here +import {RfbloyaltySharedModule, UserRouteAccessService} from './shared'; +import {RfbloyaltyHomeModule} from './home'; +import {RfbloyaltyAdminModule} from './admin/admin.module'; +import {RfbloyaltyAccountModule} from './account/account.module'; +import {RfbloyaltyEntityModule} from './entities/entity.module'; +import {customHttpProvider} from './blocks/interceptor/http.provider'; +import {PaginationConfig} from './blocks/config/uib-pagination.config'; import { + ErrorComponent, + FooterComponent, JhiMainComponent, LayoutRoutingModule, NavbarComponent, - FooterComponent, - ProfileService, PageRibbonComponent, - ErrorComponent + ProfileService } from './layouts'; +// jhipster-needle-angular-add-module-import JHipster will add new module here + @NgModule({ imports: [ BrowserModule, diff --git a/src/main/webapp/app/entities/rfb-location/rfb-location.component.ts b/src/main/webapp/app/entities/rfb-location/rfb-location.component.ts index b186461..f1acecd 100644 --- a/src/main/webapp/app/entities/rfb-location/rfb-location.component.ts +++ b/src/main/webapp/app/entities/rfb-location/rfb-location.component.ts @@ -14,7 +14,7 @@ import {PaginationConfig} from '../../blocks/config/uib-pagination.config'; }) export class RfbLocationComponent implements OnInit, OnDestroy { -currentAccount: any; + currentAccount: any; rfbLocations: RfbLocation[]; error: any; success: any; @@ -53,24 +53,28 @@ currentAccount: any; this.rfbLocationService.query({ page: this.page - 1, size: this.itemsPerPage, - sort: this.sort()}).subscribe( + sort: this.sort() + }).subscribe( (res: ResponseWrapper) => this.onSuccess(res.json, res.headers), (res: ResponseWrapper) => this.onError(res.json) ); } + loadPage(page: number) { if (page !== this.previousPage) { this.previousPage = page; this.transition(); } } + transition() { - this.router.navigate(['/rfb-location'], {queryParams: - { - page: this.page, - size: this.itemsPerPage, - sort: this.predicate + ',' + (this.reverse ? 'asc' : 'desc') - } + this.router.navigate(['/rfb-location'], { + queryParams: + { + page: this.page, + size: this.itemsPerPage, + sort: this.predicate + ',' + (this.reverse ? 'asc' : 'desc') + } }); this.loadAll(); } @@ -83,6 +87,7 @@ currentAccount: any; }]); this.loadAll(); } + ngOnInit() { this.loadAll(); this.principal.identity().then((account) => { @@ -98,6 +103,7 @@ currentAccount: any; trackId(index: number, item: RfbLocation) { return item.id; } + registerChangeInRfbLocations() { this.eventSubscriber = this.eventManager.subscribe('rfbLocationListModification', (response) => this.loadAll()); } @@ -117,6 +123,7 @@ currentAccount: any; // this.page = pagingParams.page; this.rfbLocations = data; } + private onError(error) { this.alertService.error(error.message, null, null); } diff --git a/src/main/webapp/app/entities/rfb-location/rfb-location.route.ts b/src/main/webapp/app/entities/rfb-location/rfb-location.route.ts index 6c5d2fe..e521d61 100644 --- a/src/main/webapp/app/entities/rfb-location/rfb-location.route.ts +++ b/src/main/webapp/app/entities/rfb-location/rfb-location.route.ts @@ -12,7 +12,8 @@ import {RfbLocationDeletePopupComponent} from './rfb-location-delete-dialog.comp @Injectable() export class RfbLocationResolvePagingParams implements Resolve { - constructor(private paginationUtil: JhiPaginationUtil) {} + constructor(private paginationUtil: JhiPaginationUtil) { + } resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { const page = route.queryParams['page'] ? route.queryParams['page'] : '1'; @@ -21,7 +22,7 @@ export class RfbLocationResolvePagingParams implements Resolve { page: this.paginationUtil.parsePage(page), predicate: this.paginationUtil.parsePredicate(sort), ascending: this.paginationUtil.parseAscending(sort) - }; + }; } } diff --git a/src/main/webapp/app/entities/rfb-location/rfb-location.service.ts b/src/main/webapp/app/entities/rfb-location/rfb-location.service.ts index f8f24f4..119217d 100644 --- a/src/main/webapp/app/entities/rfb-location/rfb-location.service.ts +++ b/src/main/webapp/app/entities/rfb-location/rfb-location.service.ts @@ -11,7 +11,8 @@ export class RfbLocationService { private resourceUrl = SERVER_API_URL + 'api/rfb-locations'; - constructor(private http: Http) { } + constructor(private http: Http) { + } create(rfbLocation: RfbLocation): Observable { const copy = this.convert(rfbLocation); @@ -43,6 +44,12 @@ export class RfbLocationService { return this.http.delete(`${this.resourceUrl}/${id}`); } + getRfbLeaderForLocation(id: number, req?: any): Observable { + const options = createRequestOption(req); + return this.http.get(`${this.resourceUrl}/${id}/leaders`, options) + .map((res: Response) => this.convertResponse(res)); + } + private convertResponse(res: Response): ResponseWrapper { const jsonResponse = res.json(); return new ResponseWrapper(res.headers, jsonResponse, res.status); diff --git a/src/main/webapp/app/home/home.component.html b/src/main/webapp/app/home/home.component.html index 43bccdf..db0d249 100644 --- a/src/main/webapp/app/home/home.component.html +++ b/src/main/webapp/app/home/home.component.html @@ -50,5 +50,7 @@

Check-in for today's run!

+ +
diff --git a/src/main/webapp/app/home/home.module.ts b/src/main/webapp/app/home/home.module.ts index af81dff..a9fca5a 100644 --- a/src/main/webapp/app/home/home.module.ts +++ b/src/main/webapp/app/home/home.module.ts @@ -4,6 +4,7 @@ import { RouterModule } from '@angular/router'; import { RfbloyaltySharedModule } from '../shared'; import { HOME_ROUTE, HomeComponent } from './'; +import {LeaderboardComponent} from '../leaderboard-component/leaderboard.component'; @NgModule({ imports: [ @@ -12,6 +13,7 @@ import { HOME_ROUTE, HomeComponent } from './'; ], declarations: [ HomeComponent, + LeaderboardComponent ], entryComponents: [ ], diff --git a/src/main/webapp/app/home/home.route.ts b/src/main/webapp/app/home/home.route.ts index d2cb491..17ab9e8 100644 --- a/src/main/webapp/app/home/home.route.ts +++ b/src/main/webapp/app/home/home.route.ts @@ -1,7 +1,5 @@ -import { Route } from '@angular/router'; - -import { UserRouteAccessService } from '../shared'; -import { HomeComponent } from './'; +import {Route} from '@angular/router'; +import {HomeComponent} from './'; export const HOME_ROUTE: Route = { path: '', diff --git a/src/main/webapp/app/leaderboard-component/leaderboard.component.html b/src/main/webapp/app/leaderboard-component/leaderboard.component.html new file mode 100644 index 0000000..6a48760 --- /dev/null +++ b/src/main/webapp/app/leaderboard-component/leaderboard.component.html @@ -0,0 +1,30 @@ +
+
+
+

Location's Ranking

+

Please select a Location to see it's Ranking.

+ +
+
+ + + + + + + + + + + + + +
Runner's Name Total of Runs
{{leader.userName}}{{leader.totalRuns}}
+
+
diff --git a/src/main/webapp/app/leaderboard-component/leaderboard.component.ts b/src/main/webapp/app/leaderboard-component/leaderboard.component.ts new file mode 100644 index 0000000..ea9e4e9 --- /dev/null +++ b/src/main/webapp/app/leaderboard-component/leaderboard.component.ts @@ -0,0 +1,67 @@ +import {Component, OnInit} from '@angular/core'; +import {RfbEventAttendanceService} from '../entities/rfb-event-attendance'; +import {ResponseWrapper} from '../shared'; +import {RfbLocation, RfbLocationService} from '../entities/rfb-location'; +import {JhiAlertService} from 'ng-jhipster'; +import {RfbLeaderForLocation} from './rfb-leader-for.location'; + +@Component({ + selector: 'jhi-leaderboard-component', + templateUrl: './leaderboard.component.html', + styles: [] +}) +export class LeaderboardComponent implements OnInit { + + actualLocationId: number; + actualLocation: RfbLocation; + locationList: RfbLocation[]; + leaderList: RfbLeaderForLocation[]; + + constructor( + private locationService: RfbLocationService, + private evAttdnceService: RfbEventAttendanceService, + private alertService: JhiAlertService + ) { + } + + ngOnInit() { + this.loadAllLocations(); + } + + loadAllLocations() { + this.locationService.query({ + sort: ['locationName', 'ASC'] + }).subscribe( + (res: ResponseWrapper) => this.onSuccess(res.json, res.headers), + (res: ResponseWrapper) => this.onError(res.json) + ); + } + + onSelect() { + this.locationService.find(this.actualLocationId).subscribe( + (location: RfbLocation) => { + console.log('location' + location); + this.actualLocation = location; + this.getRfbLeaderForLocation(); + }, + (res: ResponseWrapper) => this.onError(res.json) + ); + } + + getRfbLeaderForLocation() { + this.locationService.getRfbLeaderForLocation(this.actualLocationId).subscribe( + (res: ResponseWrapper) => + this.leaderList = res.json, + (res: ResponseWrapper) => this.onError(res.json) + ); + } + + private onSuccess(data, headers) { + this.locationList = data; + } + + private onError(error) { + this.alertService.error(error.message, null, null); + } + +} diff --git a/src/main/webapp/app/leaderboard-component/rfb-leader-for.location.ts b/src/main/webapp/app/leaderboard-component/rfb-leader-for.location.ts new file mode 100644 index 0000000..b880ede --- /dev/null +++ b/src/main/webapp/app/leaderboard-component/rfb-leader-for.location.ts @@ -0,0 +1,7 @@ +export class RfbLeaderForLocation { + constructor( + public userName?: string, + public totalRuns?: number + ) { + } +} diff --git a/src/main/webapp/app/shared/shared.module.ts b/src/main/webapp/app/shared/shared.module.ts index 608327c..2f5beec 100644 --- a/src/main/webapp/app/shared/shared.module.ts +++ b/src/main/webapp/app/shared/shared.module.ts @@ -1,21 +1,21 @@ -import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { DatePipe } from '@angular/common'; +import {CUSTOM_ELEMENTS_SCHEMA, NgModule} from '@angular/core'; +import {DatePipe} from '@angular/common'; import { - RfbloyaltySharedLibsModule, - RfbloyaltySharedCommonModule, - CSRFService, - AuthServerProvider, AccountService, - UserService, - StateStorageService, - LoginService, - LoginModalService, - Principal, + AuthServerProvider, + CSRFService, HasAnyAuthorityDirective, + JhiLoginModalComponent, JhiSocialComponent, + LoginModalService, + LoginService, + Principal, + RfbloyaltySharedCommonModule, + RfbloyaltySharedLibsModule, SocialService, - JhiLoginModalComponent + StateStorageService, + UserService } from './'; @NgModule({ diff --git a/src/test/java/com/rfb/service/impl/RfbLocationServiceImplTest.java b/src/test/java/com/rfb/service/impl/RfbLocationServiceImplTest.java new file mode 100644 index 0000000..338f5fe --- /dev/null +++ b/src/test/java/com/rfb/service/impl/RfbLocationServiceImplTest.java @@ -0,0 +1,76 @@ +package com.rfb.service.impl; + +import com.rfb.domain.RfbEvent; +import com.rfb.domain.RfbEventAttendance; +import com.rfb.domain.RfbLocation; +import com.rfb.domain.User; +import com.rfb.service.dto.location.RfbLeaderForLocationDTO; +import org.assertj.core.util.Sets; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.mockito.Spy; +import org.mockito.runners.MockitoJUnitRunner; + +import java.util.List; +import java.util.Set; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +@RunWith(MockitoJUnitRunner.class) +//@ContextConfiguration(classes = { RfbLocationServiceImpl.class }) +//@SpringBootTest(classes = RfbloyaltyApp.class) +public class RfbLocationServiceImplTest { + + @Spy + private RfbLocationServiceImpl service; + + @Test + public void test_getRfbLeaderForLocation() { + + + Long locationId = 1L; + + User firstUser = new User(); + firstUser.setId(1L); + firstUser.setFirstName("Cristian"); + firstUser.setLastName("Chies"); + + User secondUser = new User(); + secondUser.setId(2L); + secondUser.setFirstName("Johny"); + secondUser.setLastName("Jones"); + + RfbLocation location = new RfbLocation(); + Set events = Sets.newHashSet(); + RfbEvent event = new RfbEvent(); + Set eventAttSet = Sets.newHashSet(); + + RfbEventAttendance attnd = new RfbEventAttendance(); + attnd.setUser(firstUser); + eventAttSet.add(attnd); + attnd = new RfbEventAttendance(); + attnd.setUser(secondUser); + eventAttSet.add(attnd); + attnd = new RfbEventAttendance(); + attnd.setUser(secondUser);// adding 2 counts for second user + eventAttSet.add(attnd); + event.setRfbEventAttendances(eventAttSet); + events.add(event); + + location.setRvbEvents(events); + + Mockito.doReturn(location).when(service).getOneLocation(locationId); + List actual = service.getRfbLeaderForLocation(locationId); + + assertNotNull(actual); + assertTrue(actual.size() > 0); + // as it must be sorted by 'running count' the first position must have the highest running count + RfbLeaderForLocationDTO actualData = actual.get(0); + assertEquals(2, actualData.getTotalRuns()); + assertEquals(secondUser.getLastName() + ", " + secondUser.getFirstName(), actualData.getUserName()); + } + +}