1010import org .junit .Test ;
1111import org .schabi .newpipe .database .AppDatabase ;
1212import org .schabi .newpipe .database .feed .model .FeedGroupEntity ;
13- import org .schabi .newpipe .database .stream .model .StreamEntity ;
1413import org .schabi .newpipe .database .subscription .SubscriptionEntity ;
1514import org .schabi .newpipe .extractor .channel .ChannelInfo ;
1615import org .schabi .newpipe .extractor .exceptions .ExtractionException ;
17- import org .schabi .newpipe .extractor .localization .DateWrapper ;
18- import org .schabi .newpipe .extractor .stream .StreamInfoItem ;
19- import org .schabi .newpipe .extractor .stream .StreamType ;
2016import org .schabi .newpipe .testUtil .TestDatabase ;
2117import org .schabi .newpipe .testUtil .TrampolineSchedulerRule ;
2218
2319import java .io .IOException ;
24- import java .time .OffsetDateTime ;
25- import java .util .Comparator ;
2620import java .util .List ;
2721
2822public class SubscriptionManagerTest {
@@ -58,7 +52,7 @@ public void testInsert() throws ExtractionException, IOException {
5852 final ChannelInfo info = ChannelInfo .getInfo ("https://www.youtube.com/c/3blue1brown" );
5953 final SubscriptionEntity subscription = SubscriptionEntity .from (info );
6054
61- manager .insertSubscription (subscription , info );
55+ manager .insertSubscription (subscription );
6256 final SubscriptionEntity readSubscription = getAssertOneSubscriptionEntity ();
6357
6458 // the uid has changed, since the uid is chosen upon inserting, but the rest should match
@@ -76,7 +70,7 @@ public void testUpdateNotificationMode() throws ExtractionException, IOException
7670 final SubscriptionEntity subscription = SubscriptionEntity .from (info );
7771 subscription .setNotificationMode (0 );
7872
79- manager .insertSubscription (subscription , info );
73+ manager .insertSubscription (subscription );
8074 manager .updateNotificationMode (subscription .getServiceId (), subscription .getUrl (), 1 )
8175 .blockingAwait ();
8276 final SubscriptionEntity anotherSubscription = getAssertOneSubscriptionEntity ();
@@ -85,35 +79,4 @@ public void testUpdateNotificationMode() throws ExtractionException, IOException
8579 assertEquals (subscription .getUrl (), anotherSubscription .getUrl ());
8680 assertEquals (1 , anotherSubscription .getNotificationMode ());
8781 }
88-
89- @ Test
90- public void testRememberRecentStreams () throws ExtractionException , IOException {
91- final ChannelInfo info = ChannelInfo .getInfo ("https://www.youtube.com/c/Polyphia" );
92- final List <StreamInfoItem > relatedItems = List .of (
93- new StreamInfoItem (0 , "a" , "b" , StreamType .VIDEO_STREAM ),
94- new StreamInfoItem (1 , "c" , "d" , StreamType .AUDIO_STREAM ),
95- new StreamInfoItem (2 , "e" , "f" , StreamType .AUDIO_LIVE_STREAM ),
96- new StreamInfoItem (3 , "g" , "h" , StreamType .LIVE_STREAM ));
97- relatedItems .forEach (item -> {
98- // these two fields must be non-null for the insert to succeed
99- item .setUploaderUrl (info .getUrl ());
100- item .setUploaderName (info .getName ());
101- // the upload date must not be too much in the past for the item to actually be inserted
102- item .setUploadDate (new DateWrapper (OffsetDateTime .now ()));
103- });
104- info .setRelatedItems (relatedItems );
105- final SubscriptionEntity subscription = SubscriptionEntity .from (info );
106-
107- manager .insertSubscription (subscription , info );
108- final List <StreamEntity > streams = database .streamDAO ().getAll ().blockingFirst ();
109-
110- assertEquals (4 , streams .size ());
111- streams .sort (Comparator .comparing (StreamEntity ::getServiceId ));
112- for (int i = 0 ; i < 4 ; i ++) {
113- assertEquals (relatedItems .get (0 ).getServiceId (), streams .get (0 ).getServiceId ());
114- assertEquals (relatedItems .get (0 ).getUrl (), streams .get (0 ).getUrl ());
115- assertEquals (relatedItems .get (0 ).getName (), streams .get (0 ).getTitle ());
116- assertEquals (relatedItems .get (0 ).getStreamType (), streams .get (0 ).getStreamType ());
117- }
118- }
11982}
0 commit comments