Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,13 @@ private String parseDepositThickness(final String input) {
* @return Translated sentence representing the braking capacity.
*/
private String parseDepositBrakingCapacity(final String input) {
if ("//".equals(input)) {
return messages.getString(DEPOSIT_BRAKING_CAPACITY_MAP.get(input));
}
return messages.getString(DEPOSIT_BRAKING_CAPACITY_MAP.getOrDefault(input, "DepositBrakingCapacity.default"), Double.parseDouble(input) / 100);
}
@Override
public boolean canParse(final String input) {
return Regex.find(GENERIC_RUNWAY_REGEX, input);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,26 @@ void testParseRunwayWithGreaterThanIndicator() throws ParseException {
}

@Test
void testParseRunwayWithIncompleteInfo() {
void testParseRunwayWithNoInfo() throws ParseException {
Metar m = new Metar();
ParseException e = assertThrows(ParseException.class, () -> command.execute(m, "R16///////"));
assertEquals(Messages.getInstance().getString("ErrorCode.IncompleteRunwayInformation"), e.getErrorCode().getMessage());

command.execute(m, "R16///////");
assertThat(m.getRunways(), hasSize(1));
RunwayInfo ri = m.getRunways().get(0);
assertEquals("16", ri.getName());
assertEquals(DepositType.NOT_REPORTED, ri.getDepositType());
assertEquals(DepositCoverage.NOT_REPORTED, ri.getCoverage());
}

@Test
void testParseRunwayWithPartialInfo() throws ParseException {
Metar m = new Metar();

command.execute(m, "R88/29////");
assertThat(m.getRunways(), hasSize(1));
RunwayInfo ri = m.getRunways().get(0);
assertEquals("88", ri.getName());
assertEquals(DepositType.WET_WATER_PATCHES, ri.getDepositType());
assertEquals(DepositCoverage.FROM_51_TO_100, ri.getCoverage());
}
}
Loading