-
Notifications
You must be signed in to change notification settings - Fork 54.1k
BAEL-9467 Deserialize Response JSON as List<POJO> in Rest Assured #18866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See notes and remove the comment lines noted.
import java.io.IOException; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.List; // ADDED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the comment
import com.baeldung.restassured.model.Movie; | ||
import com.baeldung.restassured.service.AppService; | ||
|
||
import io.restassured.common.mapper.TypeRef; // NEW IMPORT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the comment
assertThat(movies.length).isEqualTo(2); | ||
} | ||
|
||
// NEW TEST CASE ADDED HERE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the comment
List<Movie> movies = get(uri + "/movies").then() | ||
.statusCode(200) | ||
.extract() | ||
// Use TypeRef to correctly deserialize JSON array into a List<POJO> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is fine because it gives the context of why we're doing this.
No description provided.