@@ -63,7 +63,7 @@ public void tearDown() {
6363 * @throws Exception
6464 */
6565 @ Test
66- public void TestShowAllByDefault () throws Exception {
66+ public void testShowAllByDefault () throws Exception {
6767 long now = System .currentTimeMillis ();
6868
6969 ObaArrivalInfo scheduledOnly = createArrival (
@@ -96,7 +96,7 @@ public void TestShowAllByDefault() throws Exception {
9696 * @throws Exception
9797 */
9898 @ Test
99- public void TestHideScheduledWithBothKinds () throws Exception {
99+ public void testHideScheduledWithBothKinds () throws Exception {
100100 prefs .edit ().putBoolean (hideScheduledKey , true ).commit ();
101101
102102 long now = System .currentTimeMillis ();
@@ -133,7 +133,7 @@ public void TestHideScheduledWithBothKinds() throws Exception {
133133 * @throws Exception
134134 */
135135 @ Test
136- public void TestHideScheduleWithAllSchedule () throws Exception {
136+ public void testHideScheduledWithAllScheduled () throws Exception {
137137 prefs .edit ().putBoolean (hideScheduledKey , true ).commit ();
138138
139139 long now = System .currentTimeMillis ();
@@ -162,6 +162,47 @@ public void TestHideScheduleWithAllSchedule() throws Exception {
162162 }
163163
164164
165+ /**
166+ * Verifies that when a route filter is applied and the "hide scheduled arrivals"
167+ * preference is enabled, scheduled-only arrivals within the filtered set are
168+ * excluded from the result.
169+ */
170+ @ Test
171+ public void testHideScheduledWithRouteFilter () throws Exception {
172+ prefs .edit ().putBoolean (hideScheduledKey , true ).commit ();
173+
174+ long now = System .currentTimeMillis ();
175+
176+ ObaArrivalInfo scheduledRoute8 = createArrival (
177+ "1_100" , "8" , "Downtown" , "STOP_1" ,
178+ now + 10 * 60_000L , 0L ,
179+ now + 10 * 60_000L , 0L ,
180+ false
181+ );
182+
183+ ObaArrivalInfo realtimeRoute49 = createArrival (
184+ "1_200" , "49" , "Uptown" , "STOP_1" ,
185+ now + 12 * 60_000L , now + 13 * 60_000L ,
186+ now + 12 * 60_000L , now + 13 * 60_000L ,
187+ true
188+ );
189+
190+ ObaArrivalInfo [] arrivals = new ObaArrivalInfo []{scheduledRoute8 , realtimeRoute49 };
191+
192+ ArrayList <String > filter = new ArrayList <>();
193+ filter .add ("1_100" );
194+ filter .add ("1_200" );
195+
196+ ArrayList <ArrivalInfo > result = ArrivalInfoUtils .convertObaArrivalInfo (
197+ context , arrivals , filter , now , false
198+ );
199+
200+ assertEquals (1 , result .size ());
201+ assertEquals ("49" , result .get (0 ).getInfo ().getShortName ());
202+ assertTrue (result .get (0 ).getPredicted ());
203+ }
204+
205+
165206 private ObaArrivalInfo createArrival (String routeId ,
166207 String shortName ,
167208 String headsign ,
0 commit comments