Skip to content

Commit 77f6940

Browse files
committed
Refactor making a PlayQueueItem to static method
1 parent e8eeac6 commit 77f6940

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

app/src/test/java/org/schabi/newpipe/player/playqueue/PlayQueueTest.java

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import static org.junit.Assert.assertEquals;
1515
import static org.junit.Assert.assertNotEquals;
16+
import static org.junit.Assert.assertNull;
1617
import static org.mockito.Mockito.doReturn;
1718
import static org.mockito.Mockito.mock;
1819
import static org.mockito.Mockito.spy;
@@ -35,6 +36,13 @@ public void fetch() {
3536
};
3637
}
3738

39+
public static PlayQueueItem makeItemWithUrl(final String url) {
40+
final StreamInfoItem infoItem = new StreamInfoItem(
41+
0, url, "", StreamType.VIDEO_STREAM
42+
);
43+
return new PlayQueueItem(infoItem);
44+
}
45+
3846
public static class SetIndexTests {
3947
private static final int SIZE = 5;
4048
private PlayQueue nonEmptyQueue;
@@ -103,22 +111,8 @@ public void indexZero() {
103111
}
104112

105113
public static class EqualsTests {
106-
private PlayQueueItem item1;
107-
private PlayQueueItem item2;
108-
109-
@Before
110-
public void setup() {
111-
final String url1 = "www.website1.com";
112-
final String url2 = "www.website2.com";
113-
final StreamInfoItem info1 = new StreamInfoItem(
114-
0, url1, "", StreamType.VIDEO_STREAM
115-
);
116-
final StreamInfoItem info2 = new StreamInfoItem(
117-
0, url2, "", StreamType.VIDEO_STREAM
118-
);
119-
item1 = new PlayQueueItem(info1);
120-
item2 = new PlayQueueItem(info2);
121-
}
114+
private final PlayQueueItem item1 = makeItemWithUrl("URL_1");
115+
private final PlayQueueItem item2 = makeItemWithUrl("URL_2");
122116

123117
@Test
124118
public void sameStreams() {

0 commit comments

Comments
 (0)