#631 - Partial Response : Return video details as json string.
This commit is contained in:
@ -30,21 +30,25 @@ import org.junit.Test;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class VideoResourceTest {
|
||||
private VideoResource resource;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
Map<String, Video> videos = new HashMap<>();
|
||||
videos.put("1", new Video("1", "Avatar", 178, "epic science fiction film", "James Cameron", "English"));
|
||||
videos.put("1", new Video("2", "Godzilla Resurgence", 120, "Action & drama movie|", "Hideaki Anno", "Japanese"));
|
||||
videos.put("1", new Video("3", "Interstellar", 169, "Adventure & Sci-Fi", "Christopher Nolan", "English"));
|
||||
Map<Integer, Video> videos = new HashMap<>();
|
||||
videos.put(1, new Video(1, "Avatar", 178, "epic science fiction film", "James Cameron", "English"));
|
||||
videos.put(2, new Video(2, "Godzilla Resurgence", 120, "Action & drama movie|", "Hideaki Anno", "Japanese"));
|
||||
videos.put(3, new Video(3, "Interstellar", 169, "Adventure & Sci-Fi", "Christopher Nolan", "English"));
|
||||
resource = new VideoResource(videos);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldGiveVideoDetailsById() {
|
||||
String details = resource.getDetails("1");
|
||||
System.out.println(details);
|
||||
String details = resource.getDetails(1);
|
||||
|
||||
String expectedDetails = "{\"id\": \"1\",\"title\": \"Avatar\",\"description\": \"epic science fiction film\",\"director\": \"James Cameron\",\"language\": \"English\",}";
|
||||
assertEquals(details, expectedDetails);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user