@@ -185,40 +185,53 @@ public void testSourceLocale() {
185185 // tools/cldr-code/src/test/resources/org/unicode/cldr/unittest/data/common/main/hy.xml
186186 final Factory myFactory = getTestDataFactory ();
187187 final CLDRFile hyFile = myFactory .make ("hy" , true );
188+ final String xpathAz = "//ldml/localeDisplayNames/languages/language[@type=\" az\" ]" ;
189+ final String xpathAa = "//ldml/localeDisplayNames/languages/language[@type=\" aa\" ]" ;
190+ final String xpathAb = "//ldml/localeDisplayNames/languages/language[@type=\" ab\" ]" ;
191+ final String xpathDayPeriod =
192+ "//ldml/dates/calendars/calendar[@type=\" gregorian\" ]/dayPeriods/dayPeriodContext[@type=\" format\" ]/dayPeriodWidth[@type=\" wide\" ]/dayPeriod[@type=\" pm\" ]" ;
188193
189- {
190- final String xpath = "//ldml/localeDisplayNames/languages/language[@type=\" az\" ]" ;
191- // no location - code-fallback
192- assertNull (hyFile .getSourceLocation (xpath ), "expected null location for " + xpath );
193- }
194- {
195- // found in hy.xml
196- final String xpath = "//ldml/localeDisplayNames/languages/language[@type=\" aa\" ]" ;
197- XMLSource .SourceLocation location = hyFile .getSourceLocation (xpath );
198- assertNotNull (location , "location for " + xpath );
199- assertEquals (testfile .toPath ().toString (), location .getSystem (), "system for " + xpath );
200- assertEquals (17 , location .getLine (), "line for " + xpath );
201- assertEquals (43 , location .getColumn (), "col for " + xpath );
202- }
203- {
204- // found in hy.xml
205- final String xpath = "//ldml/localeDisplayNames/languages/language[@type=\" ab\" ]" ;
206- XMLSource .SourceLocation location = hyFile .getSourceLocation (xpath );
207- assertNotNull (location , "location for " + xpath );
208- assertEquals (testfile .toPath ().toString (), location .getSystem (), "system for " + xpath );
209- assertEquals (18 , location .getLine (), "line for " + xpath );
210- assertEquals (64 , location .getColumn (), "col for " + xpath );
211- }
212- {
213- // found in root.xml
214- final String xpath =
215- "//ldml/dates/calendars/calendar[@type=\" gregorian\" ]/dayPeriods/dayPeriodContext[@type=\" format\" ]/dayPeriodWidth[@type=\" wide\" ]/dayPeriod[@type=\" pm\" ]" ;
216- XMLSource .SourceLocation location = hyFile .getSourceLocation (xpath );
217- assertNotNull (location , "location for " + xpath );
218- assertEquals (rootfile .toPath ().toString (), location .getSystem (), "system for " + xpath );
219- assertEquals (25 , location .getLine (), "line for " + xpath );
220- assertEquals (43 , location .getColumn (), "col for " + xpath );
221- }
194+ // null location = code-fallback
195+ final XMLSource .SourceLocation locationAz = hyFile .getSourceLocation (xpathAz );
196+ // found in hy.xml
197+ final XMLSource .SourceLocation locationAb = hyFile .getSourceLocation (xpathAb );
198+ // found in hy.xml
199+ final XMLSource .SourceLocation locationAa = hyFile .getSourceLocation (xpathAa );
200+ // found in root.xml
201+ final XMLSource .SourceLocation locationDayPeriod = hyFile .getSourceLocation (xpathDayPeriod );
202+
203+ // first assert the location objects
204+ assertAll (
205+ () -> assertNull (locationAz , "expected null location for " + xpathAz ),
206+ () -> assertNotNull (locationAa , "location for " + xpathAa ),
207+ () -> assertNotNull (locationAb , "location for " + xpathAb ),
208+ () -> assertNotNull (locationDayPeriod , "location for " + xpathDayPeriod ));
209+
210+ // next, assert against the location objects
211+ // these will have to do with the special datafiles in
212+ // . tools/cldr-code/src/test/resources/org/unicode/cldr/unittest/data/common/
213+ assertAll (
214+ () ->
215+ assertEquals (
216+ testfile .toPath ().toString (),
217+ locationAa .getSystem (),
218+ "system for " + xpathAa ),
219+ () -> assertEquals (39 , locationAa .getLine (), "line for " + xpathAa ),
220+ () -> assertEquals (43 , locationAa .getColumn (), "col for " + xpathAa ),
221+ () ->
222+ assertEquals (
223+ testfile .toPath ().toString (),
224+ locationAb .getSystem (),
225+ "system for " + xpathAb ),
226+ () -> assertEquals (40 , locationAb .getLine (), "line for " + xpathAb ),
227+ () -> assertEquals (64 , locationAb .getColumn (), "col for " + xpathAb ),
228+ () ->
229+ assertEquals (
230+ rootfile .toPath ().toString (),
231+ locationDayPeriod .getSystem (),
232+ "system for " + xpathDayPeriod ),
233+ () -> assertEquals (49 , locationDayPeriod .getLine (), "line for " + xpathDayPeriod ),
234+ () -> assertEquals (43 , locationDayPeriod .getColumn (), "col for " + xpathDayPeriod ));
222235 }
223236
224237 /**
0 commit comments