-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
src/test/java/info/movito/themoviedbapi/TmdbReviewsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package info.movito.themoviedbapi; | ||
|
||
import info.movito.themoviedbapi.model.Review; | ||
import info.movito.themoviedbapi.model.reviews.AuthorDetails; | ||
import info.movito.themoviedbapi.tools.RequestType; | ||
import info.movito.themoviedbapi.tools.TmdbException; | ||
import info.movito.themoviedbapi.util.TestUtils; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
|
||
import static info.movito.themoviedbapi.TmdbReviews.TMDB_METHOD_MOVIE_REVIEW; | ||
import static info.movito.themoviedbapi.tools.ApiUrl.TMDB_API_BASE_URL; | ||
import static info.movito.themoviedbapi.util.TestUtils.testForNullFieldsAndNewItems; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.mockito.Mockito.when; | ||
|
||
/** | ||
* Tests {@link TmdbReviews}. | ||
*/ | ||
public class TmdbReviewsTest extends AbstractTmdbApiTest { | ||
/** | ||
* Test {@link TmdbReviews#getDetails(int)} with an expected result. | ||
*/ | ||
@Test | ||
public void testGetDetails() throws IOException, TmdbException { | ||
int reviewId = 1; | ||
|
||
String body = TestUtils.readTestFile("api_responses/reviews/details.json"); | ||
URL url = new URL(TMDB_API_BASE_URL + TMDB_METHOD_MOVIE_REVIEW + "/" + reviewId); | ||
when(getTmdbUrlReader().readUrl(url, null, RequestType.GET)).thenReturn(body); | ||
|
||
TmdbReviews tmdbReviews = getTmdbApi().getReviews(); | ||
Review review = tmdbReviews.getDetails(reviewId); | ||
assertNotNull(review); | ||
testForNullFieldsAndNewItems(review); | ||
|
||
AuthorDetails authorDetails = review.getAuthorDetails(); | ||
assertNotNull(authorDetails); | ||
testForNullFieldsAndNewItems(authorDetails); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"id": "640b2aeecaaca20079decdcc", | ||
"author": "Ricardo Oliveira", | ||
"author_details": { | ||
"name": "Ricardo Oliveira", | ||
"username": "RSOliveira", | ||
"avatar_path": "/23Cl7rhsknc7IIAcZZAGKzovjTu.jpg", | ||
"rating": 9 | ||
}, | ||
"content": "\"The Last of Us\" is a post-apocalyptic TV series based on the popular video game of the same name. The story follows the journey of Joel, a smuggler, and Ellie, a teenage girl who may be the key to finding a cure for a deadly fungal infection that has ravaged the world.\r\n\r\nThe series features outstanding performances from Pedro Pascal as Joel, Bella Ramsey as Ellie, and Anna Torv as Tess. The chemistry between the main characters is excellent, and the casting is spot-on.\r\n\r\nThe show's writing is superb, and it captures the essence of the video game while adding a fresh perspective. The narrative is engaging, and the pacing is just right, with each episode leaving you on the edge of your seat, eager to see what happens next.\r\n\r\nThe show's production value is top-notch, with stunning visuals and cinematography that capture the bleak and haunting atmosphere of a post-apocalyptic world. The use of practical effects and makeup is impressive and adds to the overall immersion of the story.\r\n\r\nOverall, \"The Last of Us\" is an outstanding TV series that does justice to the source material. It's a must-watch for fans of the video game and anyone who enjoys gripping and emotional storytelling. I would rate it a 9 out of 10.\r\n\r\n \r\n\r\nWritten and Reviewed by RSOliveira", | ||
"created_at": "2023-03-10T13:04:46.674Z", | ||
"iso_639_1": "en", | ||
"media_id": 100088, | ||
"media_title": "The Last of Us", | ||
"media_type": "tv", | ||
"updated_at": "2023-03-10T13:04:46.734Z", | ||
"url": "https://www.themoviedb.org/review/640b2aeecaaca20079decdcc" | ||
} |