Refactor making a PlayQueueItem to static method

This commit is contained in:
Eric Xu 2021-05-21 23:53:45 -04:00 committed by Zhiheng Xu
parent e8eeac6735
commit 77f6940336

View file

@ -13,6 +13,7 @@ import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
@ -35,6 +36,13 @@ public class PlayQueueTest {
};
}
public static PlayQueueItem makeItemWithUrl(final String url) {
final StreamInfoItem infoItem = new StreamInfoItem(
0, url, "", StreamType.VIDEO_STREAM
);
return new PlayQueueItem(infoItem);
}
public static class SetIndexTests {
private static final int SIZE = 5;
private PlayQueue nonEmptyQueue;
@ -103,22 +111,8 @@ public class PlayQueueTest {
}
public static class EqualsTests {
private PlayQueueItem item1;
private PlayQueueItem item2;
@Before
public void setup() {
final String url1 = "www.website1.com";
final String url2 = "www.website2.com";
final StreamInfoItem info1 = new StreamInfoItem(
0, url1, "", StreamType.VIDEO_STREAM
);
final StreamInfoItem info2 = new StreamInfoItem(
0, url2, "", StreamType.VIDEO_STREAM
);
item1 = new PlayQueueItem(info1);
item2 = new PlayQueueItem(info2);
}
private final PlayQueueItem item1 = makeItemWithUrl("URL_1");
private final PlayQueueItem item2 = makeItemWithUrl("URL_2");
@Test
public void sameStreams() {