### Question:
Ranks { public Rank getDefaultRank() { return allRanks.get(defaultRankId); }  Rank getDefaultRank(); Rank getRankSingleton(Integer rankId); void loadRanks();  }### Answer:
@Test public void getDefaultRank() { RankRepository rankRepository = mock(RankRepository.class); Ranks ranks = new Ranks(1, rankRepository); Rank expectedDefault = createRank(1); Rank second = createRank(2); Rank third = createRank(3); when(rankRepository.findAll()).thenReturn( Arrays.asList(expectedDefault, second, third ) ); ranks.loadRanks(); assertEquals(expectedDefault, ranks.getDefaultRank()); assertEquals(second, ranks.getRankSingleton(2)); }