Spring Boot Unit Testing With Mockito - Service Layer [Part 2]

Тәжірибелік нұсқаулар және стиль

Spring Boot Unit Testing - Service Layer [Part 2]
Linkedin: / teddy-smith-015ba61a3
Website: www.teddysmith.io
Github: github.com/teddysmithdev

Пікірлер: 6

  • @Nyze1984
    @Nyze198411 ай бұрын

    Maybe also test the cases where exceptions are thrown?

  • @storm.5252
    @storm.5252 Жыл бұрын

    Very good

  • @rohansahu1212
    @rohansahu12124 ай бұрын

    Awesome ❤

  • @goshochernii
    @goshochernii3 ай бұрын

    what is the difference between just this review.setPokemon(pokemon); and doing that pokemon.setReviews(Arrays.asList(review)); review.setPokemon(pokemon);

  • @Grainme47

    @Grainme47

    2 ай бұрын

    yeah I've got the same question!

  • @user-yn5gt7jz9k

    @user-yn5gt7jz9k

    Ай бұрын

    In this specific case test, if we focus on the line 58 where we have the if(logic). You will note that the scenarios is looking if in the review has the pokemon_id. After that, the second act, just get the pokemon_id. After that, has been a comparation if the id inside the pokemon_review is equals pokemon_id If in this scenario we set like this: pokemon.setReviews(Arrays.asList(review)); the condition at line 58 will not be true, cause we wasn't set the pokemon_id into the review object. I hope this was helpfully.

Келесі