-
Notifications
You must be signed in to change notification settings - Fork 265
Expand file tree
/
Copy pathVideoLibraryTest.java
More file actions
45 lines (35 loc) · 1.24 KB
/
VideoLibraryTest.java
File metadata and controls
45 lines (35 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.google;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class VideoLibraryTest {
private prevVideoLibrary videoLibrary;
@BeforeEach
public void setUp() {
videoLibrary = new prevVideoLibrary();
}
@Test
public void testLibraryHasAllVideos() {
assertEquals(videoLibrary.getVideos().size(), 5);
}
@Test
public void testLibraryParsesTagsCorrectly() {
var video = videoLibrary.getVideo("amazing_cats_video_id");
assertNotNull(video);
assertEquals("Amazing Cats", video.getTitle());
assertEquals("amazing_cats_video_id", video.getVideoId());
assertEquals(new ArrayList<>(List.of("#cat", "#animal")), video.getTags());
}
@Test
public void testLibraryParsesVideoCorrectlyWithoutTags() {
var video = videoLibrary.getVideo("nothing_video_id");
assertNotNull(video);
assertEquals("Video about nothing", video.getTitle());
assertEquals("nothing_video_id", video.getVideoId());
assertTrue(video.getTags().isEmpty());
}
}