	@Test
	public void testListLatestEventsByAppName() {

		setSecuirtyContext(TEAMNAME, USERNAME);
		EventRecorder eventRecorder = createEvent(TEAMNAME);
		EventRecorder eventSecondRecorder = createEvent(TEAMNAME);
		TeamUser teamUser = createTeamUserObject(USERNAME, TEAMNAME);

		List<EventRecorder> events = new ArrayList<>();
		events.add(eventRecorder);
		events.add(eventSecondRecorder);
		Page<EventRecorder> eventRecorderPage = new PageImpl<>(events);

		when(teamUserRepository.findByUserNameAndDefaultFlag(USERNAME, "Y")).thenReturn(teamUser);
		when(eventRepository.findByAppName(TEAMNAME, eventRecorder.field(APPNAME), new PageRequest(0, 9999)))
				.thenReturn(eventRecorderPage);

		@SuppressWarnings("unchecked")
		Map<String, EventRecorder> latestEventMap = (Map<String, EventRecorder>) eventController
				.listLatestEventsByAppName(req, eventRecorder.field(APPNAME)).getBody();
		assertEquals(1, latestEventMap.size());
		assertEquals(EventStatus.COMPLETED, latestEventMap.get(eventRecorder.field("name")).getEventStatusType());
	}