@@ -32,7 +32,7 @@ public class FeedMetadataTest {
3232 ValidatorLoader validatorLoader ;
3333 File rootDir ;
3434
35- private void createDataFile (String filename , String content ) throws IOException {
35+ public void createDataFile (String filename , String content ) throws IOException {
3636 File dataFile = tmpDir .newFile ("data/" + filename );
3737 try (BufferedWriter writer = new BufferedWriter (new FileWriter (dataFile ))) {
3838 writer .write (content );
@@ -120,6 +120,105 @@ public void omitsRouteNamesComponentTest3() throws IOException, InterruptedExcep
120120 ImmutableList .of (GtfsRouteTableDescriptor .class , GtfsAgencyTableDescriptor .class ));
121121 }
122122
123+ @ Test
124+ /**
125+ * This method is to test when both route_color and route_text_color are present in routes.txt,
126+ * and they each have two records
127+ */
128+ public void containsRouteColorsComponentTest () throws IOException , InterruptedException {
129+ String routesContent =
130+ "route_id,agency_id,route_short_name,route_long_name,route_desc,route_type,route_url,route_color,route_text_color\n "
131+ + "01,LTC -2023 Spring Schedules,01,Route 1,,3,,70C2DA,000000\n "
132+ + "02,LTC -2023 Spring Schedules,02,Route 2,,3,,0080C0,000000\n " ;
133+ createDataFile ("routes.txt" , routesContent );
134+ validateSpecFeature (
135+ "Route Colors" ,
136+ "Yes" ,
137+ ImmutableList .of (GtfsRouteTableDescriptor .class , GtfsAgencyTableDescriptor .class ));
138+ }
139+
140+ /**
141+ * This method is to test when both route_color and route_text_color are present in routes.txt,
142+ * and none of them has records
143+ */
144+ @ Test
145+ public void omitsRouteColorsComponentTest1 () throws IOException , InterruptedException {
146+ String routesContent =
147+ "route_id,agency_id,route_short_name,route_long_name,route_desc,route_type,route_url,route_color,route_text_color\n "
148+ + "01,LTC -2023 Spring Schedules,01,Route 1,,3,,,\n "
149+ + "02,LTC -2023 Spring Schedules,02,Route 2,,3,,,\n " ;
150+ createDataFile ("routes.txt" , routesContent );
151+ validateSpecFeature (
152+ "Route Colors" ,
153+ "No" ,
154+ ImmutableList .of (GtfsRouteTableDescriptor .class , GtfsAgencyTableDescriptor .class ));
155+ }
156+
157+ /**
158+ * This method is to test when both route_color and route_text_color are present in routes.txt,
159+ * and they each have one record
160+ */
161+ @ Test
162+ public void omitsRouteColorsComponentTest2 () throws IOException , InterruptedException {
163+ String routesContent =
164+ "route_id,agency_id,route_short_name,route_long_name,route_desc,route_type,route_url,route_color,route_text_color\n "
165+ + "01,LTC -2023 Spring Schedules,01,Route 1,,3,,,70C2DA\n "
166+ + "02,LTC -2023 Spring Schedules,02,Route 2,,3,,0080C0,\n " ;
167+ createDataFile ("routes.txt" , routesContent );
168+ validateSpecFeature (
169+ "Route Colors" ,
170+ "Yes" ,
171+ ImmutableList .of (GtfsRouteTableDescriptor .class , GtfsAgencyTableDescriptor .class ));
172+ }
173+
174+ /**
175+ * This method is to test when both route_color and route_text_color are present in routes.txt,
176+ * and one has two records, one has none
177+ */
178+ @ Test
179+ public void omitsRouteColorsComponentTest3 () throws IOException , InterruptedException {
180+ String routesContent =
181+ "route_id,agency_id,route_short_name,route_long_name,route_desc,route_type,route_url,route_color,route_text_color\n "
182+ + "01,LTC -2023 Spring Schedules,01,Route 1,,3,,0080C0,000000\n "
183+ + "02,LTC -2023 Spring Schedules,02,Route 2,,3,,,\n " ;
184+ createDataFile ("routes.txt" , routesContent );
185+ validateSpecFeature (
186+ "Route Colors" ,
187+ "Yes" ,
188+ ImmutableList .of (GtfsRouteTableDescriptor .class , GtfsAgencyTableDescriptor .class ));
189+ }
190+
191+ /**
192+ * This method is to test when route_color is present and route_text_color is missing in
193+ * routes.txt
194+ */
195+ @ Test
196+ public void omitsRouteColorsComponentTest4 () throws IOException , InterruptedException {
197+ String routesContent =
198+ "route_id,agency_id,route_short_name,route_long_name,route_desc,route_type,route_url,route_color\n "
199+ + "01,LTC -2023 Spring Schedules,01,Route 1,,3,,,\n "
200+ + "02,LTC -2023 Spring Schedules,02,Route 2,,3,,70C2DA\n " ;
201+ createDataFile ("routes.txt" , routesContent );
202+ validateSpecFeature (
203+ "Route Colors" ,
204+ "No" ,
205+ ImmutableList .of (GtfsRouteTableDescriptor .class , GtfsAgencyTableDescriptor .class ));
206+ }
207+
208+ /** This method is to test when both route_color and route_text_color are missing in routes.txt */
209+ @ Test
210+ public void omitsRouteColorsComponentTest5 () throws IOException , InterruptedException {
211+ String routesContent =
212+ "route_id,agency_id,route_short_name,route_long_name,route_desc,route_type,route_url\n "
213+ + "01,LTC -2023 Spring Schedules,01,Route 1,,3,\n "
214+ + "02,LTC -2023 Spring Schedules,02,Route 2,,3,\n " ;
215+ createDataFile ("routes.txt" , routesContent );
216+ validateSpecFeature (
217+ "Route Colors" ,
218+ "No" ,
219+ ImmutableList .of (GtfsRouteTableDescriptor .class , GtfsAgencyTableDescriptor .class ));
220+ }
221+
123222 @ Test
124223 public void containsPathwaysComponentTest () throws IOException , InterruptedException {
125224 String pathwayContent =
0 commit comments