### Question:
MatchHelper { public static @Nullable Match getNextMatchPlayed(List<Match> matches) { if (matches == null || matches.isEmpty()) return null; Match last = null; for (int i = matches.size() - 1; i >= 0; i--) { Match m = matches.get(i); if (m.hasBeenPlayed()) { return last; } last = m; } return matches.get(0); } private  MatchHelper(); static boolean validateMatchKey(String key); static String getEventKeyFromMatchKey(String matchKey); static @Nullable Match getNextMatchPlayed(List<Match> matches); static @Nullable Match getLastMatchPlayed(List<Match> matches); static String getMatchTitleFromMatchKey(Context context, String matchKey); static String getAbbrevMatchTitleFromMatchKey(Context context, String matchKey);  }### Answer:
@Test public void testGetNextMatchPlayed() { List<Match> matches; Match nextMatch; assertNull(MatchHelper.getNextMatchPlayed(null)); assertNull(MatchHelper.getNextMatchPlayed(new ArrayList<>())); matches = mockMatchList(10); nextMatch = MatchHelper.getNextMatchPlayed(matches); assertEquals(nextMatch, matches.get(0)); markMatchesPlayed(matches, 0, 4); nextMatch = MatchHelper.getNextMatchPlayed(matches); assertEquals(nextMatch, matches.get(4)); markMatchesPlayed(matches, 6, 8); nextMatch = MatchHelper.getNextMatchPlayed(matches); assertEquals(nextMatch, matches.get(8)); markMatchesPlayed(matches, 0, 10); nextMatch = MatchHelper.getNextMatchPlayed(matches); assertNull(nextMatch); }