Skip to content

Commit

Permalink
chore: 3차 스프린트 cd 시연 (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
jongmee authored Aug 9, 2024
1 parent bcbae12 commit 7b98c53
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public PokemonAbilityWithPokemonsResponse findAbilityDetails(Long id) {
List<Pokemon> pokemons = ability.getPokemonAbilityMappings().stream()
.map(PokemonAbilityMapping::getPokemon)
.distinct()
.sorted(Comparator.comparingLong(Pokemon::getId))
.toList();
List<SameAbilityPokemonResponse> pokemonResponses = toSameAbilityPokemonResponses(pokemons);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ void findAbilityDetailsWhenAbilityIdNotExist() {
.hasMessage(ErrorMessage.POKEMON_ABILITY_NOT_FOUND.getMessage());
}

// @Test
// @DisplayName("같은 특성을 가진 포켓몬 목록을 조회할 때 id 순으로 정렬한다.")
// void findPokemonsOrderByIdInAbilityDetails() {
// Long abilityId = pokemonAbilityRepository.findAll().get(0).getId();
//
// PokemonAbilityWithPokemonsResponse pokemonAbilityWithPokemons = pokemonAbilityService.findAbilityDetails(
// abilityId);
//
// List<Long> pokemonIds = pokemonAbilityWithPokemons.pokemons().stream()
// .map(SameAbilityPokemonResponse::id)
// .toList();
// assertThat(pokemonIds).isSortedAccordingTo(Long::compare);
// }
@Test
@DisplayName("같은 특성을 가진 포켓몬 목록을 조회할 때 id 순으로 정렬한다.")
void findPokemonsOrderByIdInAbilityDetails() {
Long abilityId = pokemonAbilityRepository.findAll().get(0).getId();

PokemonAbilityWithPokemonsResponse pokemonAbilityWithPokemons = pokemonAbilityService.findAbilityDetails(
abilityId);

List<Long> pokemonIds = pokemonAbilityWithPokemons.pokemons().stream()
.map(SameAbilityPokemonResponse::id)
.toList();
assertThat(pokemonIds).isSortedAccordingTo(Long::compare);
}

@Test
@DisplayName("같은 특성을 가진 포켓몬 목록을 조회할 때 포켓몬의 타입을 id 순으로 정렬한다.")
Expand Down

0 comments on commit 7b98c53

Please sign in to comment.