diff --git a/metarParser-parsers/src/main/java/io/github/mivek/command/common/WindCommand.java b/metarParser-parsers/src/main/java/io/github/mivek/command/common/WindCommand.java index 345e196a..ec4895c5 100644 --- a/metarParser-parsers/src/main/java/io/github/mivek/command/common/WindCommand.java +++ b/metarParser-parsers/src/main/java/io/github/mivek/command/common/WindCommand.java @@ -11,7 +11,7 @@ */ public final class WindCommand implements BaseWindCommand { /** Pattern regex for wind. */ - private static final Pattern WIND_REGEX = Pattern.compile("^(VRB|00|[0-3]\\d{2})(\\d{2})G?(\\d{2})?(KT|MPS|KM/H)?"); + private static final Pattern WIND_REGEX = Pattern.compile("^(VRB|00|[0-3]\\d{2})(\\d{2})G?(\\d{2,3})?(KT|MPS|KM/H)?"); /** * Package private constructor. diff --git a/metarParser-parsers/src/main/java/io/github/mivek/command/common/WindShearCommand.java b/metarParser-parsers/src/main/java/io/github/mivek/command/common/WindShearCommand.java index 0c687ef0..7daecc89 100644 --- a/metarParser-parsers/src/main/java/io/github/mivek/command/common/WindShearCommand.java +++ b/metarParser-parsers/src/main/java/io/github/mivek/command/common/WindShearCommand.java @@ -11,7 +11,7 @@ */ public final class WindShearCommand implements BaseWindCommand { /** Pattern regex for windshear. */ - private static final Pattern WIND_SHEAR_REGEX = Pattern.compile("^WS(\\d{3})/(\\w{3})(\\d{2})G?(\\d{2})?(KT|MPS|KM/H)"); + private static final Pattern WIND_SHEAR_REGEX = Pattern.compile("^WS(\\d{3})/(\\w{3})(\\d{2})G?(\\d{2,3})?(KT|MPS|KM/H)"); /** * Package private constructor. diff --git a/metarParser-parsers/src/test/java/io/github/mivek/command/common/WindCommandTest.java b/metarParser-parsers/src/test/java/io/github/mivek/command/common/WindCommandTest.java index c11e92c3..bb07b832 100644 --- a/metarParser-parsers/src/test/java/io/github/mivek/command/common/WindCommandTest.java +++ b/metarParser-parsers/src/test/java/io/github/mivek/command/common/WindCommandTest.java @@ -84,4 +84,14 @@ void testExecuteWithExistingWind() { assertTrue(command.execute(m, "VRB08KT")); assertEquals(wind1, m.getWind()); } + + @Test + void testParseWindThreeDigitGust() { + Wind w = command.parseWind("12017G015KT"); + assertEquals(Messages.getInstance().getString("Converter.ESE"), w.getDirection()); + assertEquals(120, w.getDirectionDegrees()); + assertEquals(17, w.getSpeed()); + assertEquals(15, w.getGust()); + assertEquals("KT", w.getUnit()); + } }