From 92484bde4a4339ca7c230b5d266746bd7fe285f2 Mon Sep 17 00:00:00 2001 From: jk KPADEY Date: Sat, 28 Nov 2020 18:45:51 +0100 Subject: [PATCH 1/3] Rewrite cardinal direction method. Added translations Signed-off-by: jk KPADEY --- .../java/io/github/mivek/utils/Converter.java | 58 +-- .../internationalization/messages.properties | 8 + .../messages_fr.properties | 332 +++++++++--------- .../io/github/mivek/utils/ConverterTest.java | 18 +- .../mivek/utils/DegreesToDirectionTest.java | 8 +- .../mivek/command/common/WindCommandTest.java | 4 +- 6 files changed, 192 insertions(+), 236 deletions(-) diff --git a/metarParser-commons/src/main/java/io/github/mivek/utils/Converter.java b/metarParser-commons/src/main/java/io/github/mivek/utils/Converter.java index 806eed3f..1c1a37c3 100644 --- a/metarParser-commons/src/main/java/io/github/mivek/utils/Converter.java +++ b/metarParser-commons/src/main/java/io/github/mivek/utils/Converter.java @@ -10,23 +10,11 @@ * @author mivek */ public final class Converter { - - /** North East minimal degrees. */ - private static final double NORTH_EAST_MIN = 22.5; - /** North east maximal degrees. */ - private static final double NORTH_EAST_MAX = 67.5; - /** East degrees. */ - private static final double EAST = 112.5; - /** South East degrees. */ - private static final double SOUTH_EAST = 157.5; - /** South degrees. */ - private static final double SOUTH = 202.5; - /** North West degrees. */ - private static final double NORTH_WEST = 337.5; - /** West degrees. */ - private static final double WEST = 292.5; - /** South west degrees. */ - private static final double SOUTH_WEST = 247.5; + /** + * Arrays of cardinal directions. + */ + private static final String[] DIRECTIONS = {"N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", + "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"}; /** * Private constructor. @@ -42,47 +30,13 @@ private Converter() { */ public static String degreesToDirection(final String degreesStr) { double degrees; - String res; try { degrees = Double.parseDouble(degreesStr); } catch (NumberFormatException e) { return Messages.getInstance().getString("Converter.VRB"); } - if (isBetween(degrees, NORTH_EAST_MIN, SOUTH)) { - if (isBetween(degrees, NORTH_EAST_MIN, NORTH_EAST_MAX)) { - res = Messages.getInstance().getString("Converter.NE"); - } else if (isBetween(degrees, NORTH_EAST_MAX, EAST)) { - res = Messages.getInstance().getString("Converter.E"); - } else if (isBetween(degrees, EAST, SOUTH_EAST)) { - res = Messages.getInstance().getString("Converter.SE"); - } else { - res = Messages.getInstance().getString("Converter.S"); - } - } else { - if (isBetween(degrees, SOUTH, SOUTH_WEST)) { - res = Messages.getInstance().getString("Converter.SW"); - } else if (isBetween(degrees, SOUTH_WEST, WEST)) { - res = Messages.getInstance().getString("Converter.W"); - } else if (isBetween(degrees, WEST, NORTH_WEST)) { - res = Messages.getInstance().getString("Converter.NW"); - } else { - res = Messages.getInstance().getString("Converter.N"); - } - } - return res; - } - - /** - * Checks if num is between lower and max. - * - * @param num double to test - * @param lower the minimum value, included. - * @param max The maximum value, exluded. - * @return true if num is between lower and max, false otherwise. - */ - static boolean isBetween(final double num, final double lower, final double max) { - return lower <= num && max > num; + return Messages.getInstance().getString("Converter." + DIRECTIONS[(int)((degrees+11.5)/22.5)]); } /** diff --git a/metarParser-commons/src/main/resources/internationalization/messages.properties b/metarParser-commons/src/main/resources/internationalization/messages.properties index 1b50449e..c6e859f1 100644 --- a/metarParser-commons/src/main/resources/internationalization/messages.properties +++ b/metarParser-commons/src/main/resources/internationalization/messages.properties @@ -104,16 +104,24 @@ MetarFacade.InvalidIcao=Icao code is invalid. Converter.D=decreasing Converter.E=East +Converter.ENE=East North East +Converter.ESE=East South East Converter.N=North Converter.NE=North East +Converter.NNE=North North East +Converter.NNW=North North West Converter.NSC=no significant change Converter.NW=North West Converter.S=South Converter.SE=South East +Converter.SSE=South South East +Converter.SSW=South South West Converter.SW=South West Converter.U=up rising Converter.VRB=Variable Converter.W=West +Converter.WNW=West North West +Converter.WSW=West South West WeatherChangeType.FM=From WeatherChangeType.BECMG=Becoming diff --git a/metarParser-commons/src/main/resources/internationalization/messages_fr.properties b/metarParser-commons/src/main/resources/internationalization/messages_fr.properties index 3dd05e3f..a401b2f1 100644 --- a/metarParser-commons/src/main/resources/internationalization/messages_fr.properties +++ b/metarParser-commons/src/main/resources/internationalization/messages_fr.properties @@ -1,163 +1,169 @@ -CloudQuantity.BKN=nuages fragment\u00e9s -CloudQuantity.FEW=peu -CloudQuantity.NSC=pas de nuages significatifs. -CloudQuantity.OVC=ciel couvert -CloudQuantity.SCT=nuages \u00e9pars -CloudQuantity.SKC=pas de nuage - -CloudType.AC=Altocumulus -CloudType.AS=Altostratus -CloudType.CB=Cumunolinbus -CloudType.CC=Cirrocumulus -CloudType.CI=Cirrus -CloudType.CS=Cirrostratus -CloudType.CU=Cumulus -CloudType.NS=Nimbostratus -CloudType.SC=Stratocumulus -CloudType.ST=Stratus -CloudType.TCU=Towering cumulus - -Descriptive.BC=bancs -Descriptive.BL=chasse-poussi\u00e8re haute -Descriptive.DR=chasse-poussi\u00e8re basse -Descriptive.FZ=se congelant -Descriptive.MI=mince -Descriptive.PR=partiel -Descriptive.SH=averses de -Descriptive.TS=orage -Error.prefix=Une erreur est survenue. Code erreur n° -ErrorCode.AirportNotFound=L'a\u00e9roport n'a pas \u00e9t\u00e9 trouv\u00e9 pour ce message. -ErrorCode.InvalidMessage=Le message entr\u00e9 est invalide. - -Intensity.-=Faible -Intensity.+=Fort -Intensity.VC=Au voisinage de - -Phenomenon.BR=brume -Phenomenon.DS=temp\u00eate de poussi\u00e8re -Phenomenon.DU=poussi\u00e8res g\u00e9n\u00e9ralis\u00e9es -Phenomenon.DZ=bruine -Phenomenon.FC=nuage en entonnoir -Phenomenon.FG=brouillard -Phenomenon.FU=fum\u00e9e -Phenomenon.GR=gr\u00eale -Phenomenon.GS=gr\ue009sil -Phenomenon.HZ=brume s\u00e8che -Phenomenon.IC=cristaux de glace -Phenomenon.PL=granules de glace -Phenomenon.PO=tourbillon de poussi\u00e8res sable -Phenomenon.PY=spray -Phenomenon.RA=pluie -Phenomenon.SA=sable -Phenomenon.SG=neige en grains -Phenomenon.SN=neige -Phenomenon.SQ=grains -Phenomenon.SS=temp\u00eate de sable -Phenomenon.UP=pr\u00e9cipitation inconnue -Phenomenon.VA=cendres volcaniques -Phenomenon.TS=orage -Remark.AO1=stations automatis\u00e9es sans discriminateur de pr\u00e9cipitation -Remark.AO2=stations automatis\u00e9es avec discriminateur de pr\u00e9cipitation -Remark.BASED=bas\u00e9e -Remark.Ceiling.Height=variation du plafond entre {0} et {1} pieds -Remark.Ceiling.Second.Location=plafond de {0} pieds mesur\u00e9 par un second capteur situ\u00e9 \u00e0 {1} -Remark.FCST=pr\u00e9vision -Remark.FUNNELCLOUD=nuage en entonnoir -Remark.Hail=les plus gros gr\u00ealons ont un diam\u00e8tre de {0} pouces -Remark.Hail.LesserThan=les plus gros gr\u00ealons ont un diam\u00e8tre plus petit que {0} pouces -Remark.HVY=fort -Remark.LGT=l\u00e9ger -Remark.MOD=mod\u00e9r\u00e9 -Remark.Obscuration=couche de {0} \u00e0 {1} pieds compos\u00e9e de {2} -Remark.ON=sur -Remark.NXT=prochain -Remark.PeakWind=vent de pointe de {1} noeuds en provenance de {0} degr\u00e9s \u00e0 {2}:{3} -Remark.Precipitation.Beg.End={0} {1} commencant \u00e0 {2}:{3} finissant \u00e0 {4}:{5} -Remark.PRESFR=diminution rapide de la pression -Remark.PRESRR=augmentation rapide de la pression -Remark.Sea.Level.Pressure=pression au niveau de la mer de {0} HPa -Remark.SLPNO=pression au niveau de la mer non disponible -Remark.Second.Location.Visibility=visibilit\u00e9 de {0} SM mesur\u00e9 par un capteur situ\u00e9 \u00e0 {1} -Remark.Sector.Visibility=visibilit\u00e9 de {1} SM dans la direction {0} -Remark.Snow.Increasing.Rapidly=\u00e9paisseur de neige de {0} pouces sur la derni\u00e8re heure avec une \u00e9paisseur totale au sol de {1} pouces -Remark.Snow.Pellets={0} gr\u00e9sil -Remark.Surface.Visibility=visibility de surface de {0} miles -Remark.Thunderstorm.Location=orage se situant {0} de la station -Remark.Thunderstorm.Location.Moving=orage se situant {0} de la station se d\u00e9placant vers {1} -Remark.Tornadic.Activity.Beginning={0} commencant \u00e0 {1}:{2} {3} SM {4} de la station -Remark.Tornadic.Activity.BegEnd={0} commencant \u00e0 {1}:{2} finissant \u00e0 {3}:{4} {5} SM {6} de la station -Remark.Tornadic.Activity.Ending={0} finissant \u00e0 {1}:{2} {3} SM {4} de la station -Remark.TORNADO=tornado -Remark.Tower.Visibility=visibility de la tour de contr\u00f4le de {0} miles -Remark.Variable.Prevailing.Visibility=variation de la visibilit\u00e9 dominante entre {0} et {1} SM -Remark.Variable.Sky.Condition=couche de nuages variant entre {0} et {1} -Remark.Variable.Sky.Condition.Height=couche de nuages \u00e0 {0} pieds variant entre {1} et {2} -Remark.VIRGA=virga -Remark.Virga.Direction=virga au {0} de la station -Remark.WATERSPOUT=trombe -Remark.WindShift=changement de vent \u00e0 {0}:{1} -Remark.WindShift.FROPA=changement de vent accompagn\u00e9 d'un passage de front \u00e0 {0}:{1} - -MetarFacade.InvalidIcao=Code ICAO invalide. - -Converter.D=decroissant -Converter.E=Est -Converter.N=Nord -Converter.NE=Nord Est -Converter.NSC=Aucun changement significatif -Converter.NW=Nord Ouest -Converter.S=Est -Converter.SE=Sud Est -Converter.SW=Sud Ouest -Converter.U=accroissement -Converter.VRB=Variable -Converter.W=Ouest -WeatherChangeType.FM=De -WeatherChangeType.BECMG=Devenant -WeatherChangeType.TEMPO=Temporairement -WeatherChangeType.PROB=Probabilit\u00e9 - -TimeIndicator.AT=\u00e0 -TimeIndicator.FM=De -TimeIndicator.TL=jusqu'\u00e0 -ToString.airport=a\u00e9roport -ToString.altimeter=altim\u00e8tre (hPa) -ToString.amendment=amendement -ToString.clouds=nuages -ToString.day.month=jour du mois -ToString.day.hour=heure du jour -ToString.descriptive=descriptif -ToString.dew.point=point de ros\u00e9e -ToString.height.feet=altitude (pieds) -ToString.height.meter=altitude (m) -ToString.intensity=intensit\u00e9 -ToString.message=message original -ToString.name=nom -ToString.phenomenons=ph\u00e9nom\u00e8nes -ToString.probability=probabilit\u00e9 -ToString.quantity=quantit\u00e9 -ToString.remark=remarques -ToString.report.time=heure du rapport -ToString.runway.info=informations sur la piste -ToString.temperature=tempr\u00e9rature (°C) -ToString.temperature.max=temp\u00e9rature maximale (°C) -ToString.temperature.min=temp\u00e9rature minimale (°C) -ToString.trend=tendance -ToString.trends=tendances -ToString.visibility.main=visibilit\u00e9 principale -ToString.visibility.min=visibilit\u00e9 minimale -ToString.visibility.min.direction=direction de la visibilit\u00e9 minimale -ToString.visibility.max=visibilit\u00e9 maximale -ToString.vertical.visibility=visibilit\u00e9 verticale (pieds) -ToString.weather.conditions=conditions m\u00e9t\u00e9orologique -ToString.wind.direction.degrees=direction (degr\u00e9s) -ToString.wind.gusts=rafales -ToString.wind.min.variation=variation minimale du vent -ToString.wind.max.variation=variation maximale du vent -ToString.wind.speed=vitesse -ToString.wind.unit=unit\u00e9 -ToString.start.day.month=jour de d/u00e9but du mois -ToString.start.hour.day=heure de d/u00e9but du jour -ToString.start.minute=minute de d/u00e9but -ToString.end.day.month=jour de fin du mois -ToString.end.hour.day=heure de fin du jour +CloudQuantity.BKN = nuages fragmentu00e9s +CloudQuantity.FEW = peu +CloudQuantity.NSC = pas de nuages significatifs. +CloudQuantity.OVC = ciel couvert +CloudQuantity.SCT = nuages u00e9pars +CloudQuantity.SKC = pas de nuage +CloudType.AC = Altocumulus +CloudType.AS = Altostratus +CloudType.CB = Cumunolinbus +CloudType.CC = Cirrocumulus +CloudType.CI = Cirrus +CloudType.CS = Cirrostratus +CloudType.CU = Cumulus +CloudType.NS = Nimbostratus +CloudType.SC = Stratocumulus +CloudType.ST = Stratus +CloudType.TCU = Towering cumulus +Descriptive.BC = bancs +Descriptive.BL = chasse-poussiu00e8re haute +Descriptive.DR = chasse-poussiu00e8re basse +Descriptive.FZ = se congelant +Descriptive.MI = mince +Descriptive.PR = partiel +Descriptive.SH = averses de +Descriptive.TS = orage +Error.prefix = Une erreur est survenue. Code erreur n° +ErrorCode.AirportNotFound = L'au00e9roport n'a pas u00e9tu00e9 trouvu00e9 pour ce message. +ErrorCode.InvalidMessage = Le message entru00e9 est invalide. +Intensity.- = Faible +Intensity.+ = Fort +Intensity.VC = Au voisinage de +Phenomenon.BR = brume +Phenomenon.DS = tempu00eate de poussiu00e8re +Phenomenon.DU = poussiu00e8res gu00e9nu00e9ralisu00e9es +Phenomenon.DZ = bruine +Phenomenon.FC = nuage en entonnoir +Phenomenon.FG = brouillard +Phenomenon.FU = fumu00e9e +Phenomenon.GR = gru00eale +Phenomenon.GS = grue009sil +Phenomenon.HZ = brume su00e8che +Phenomenon.IC = cristaux de glace +Phenomenon.PL = granules de glace +Phenomenon.PO = tourbillon de poussiu00e8res sable +Phenomenon.PY = spray +Phenomenon.RA = pluie +Phenomenon.SA = sable +Phenomenon.SG = neige en grains +Phenomenon.SN = neige +Phenomenon.SQ = grains +Phenomenon.SS = tempu00eate de sable +Phenomenon.UP = pru00e9cipitation inconnue +Phenomenon.VA = cendres volcaniques +MetarFacade.InvalidIcao = Code ICAO invalide. +Converter.D = decroissant +Converter.E = Est +Converter.N = Nord +Converter.NE = Nord Est +Converter.NSC = Aucun changement significatif +Converter.NW = Nord Ouest +Converter.S = Est +Converter.SE = Sud Est +Converter.SW = Sud Ouest +Converter.U = accroissement +Converter.VRB = Variable +Converter.W = Ouest +WeatherChangeType.FM = De +WeatherChangeType.BECMG = Devenant +WeatherChangeType.TEMPO = Temporary +WeatherChangeType.PROB = Probabilitu00e9 +TimeIndicator.AT = u00e0 +TimeIndicator.TL = jusqu'u00e0 +Phenomenon.TS = orage +Remark.AO1 = stations automatisu00e9es sans discriminateur de pru00e9cipitation +Remark.AO2 = stations automatisu00e9es avec discriminateur de pru00e9cipitation +Remark.BASED = basu00e9e +Remark.Ceiling.Height = variation du plafond entre {0} et {1} pieds +Remark.Ceiling.Second.Location = plafond de {0} pieds mesuru00e9 par un second capteur situu00e9 u00e0 {1} +Remark.FCST = pru00e9vision +Remark.FUNNELCLOUD = nuage en entonnoir +Remark.Hail = les plus gros gru00ealons ont un diamu00e8tre de {0} pouces +Remark.Hail.LesserThan = les plus gros gru00ealons ont un diamu00e8tre plus petit que {0} pouces +Remark.HVY = fort +Remark.LGT = lu00e9ger +Remark.MOD = modu00e9ru00e9 +Remark.Obscuration = couche de {0} u00e0 {1} pieds composu00e9e de {2} +Remark.ON = sur +Remark.NXT = prochain +Remark.PeakWind = vent de pointe de {1} noeuds en provenance de {0} degru00e9s u00e0 {2}\:{3} +Remark.Precipitation.Beg.End = {0} {1} commencant u00e0 {2}\:{3} finissant u00e0 {4}\:{5} +Remark.PRESFR = diminution rapide de la pression +Remark.PRESRR = augmentation rapide de la pression +Remark.Second.Location.Visibility = visibilitu00e9 de {0} SM mesuru00e9 par un capteur situu00e9 u00e0 {1} +Remark.Sea.Level.Pressure = pression au niveau de la mer de {0} HPa +Remark.Sector.Visibility = visibilitu00e9 de {1} SM dans la direction {0} +Remark.SLPNO = pression au niveau de la mer non disponible +Remark.Snow.Pellets = {0} gru00e9sil +Remark.Surface.Visibility = visibility de surface de {0} miles +Remark.Thunderstorm.Location = orage se situant {0} de la station +Remark.Thunderstorm.Location.Moving = orage se situant {0} de la station se du00e9placant vers {1} +Remark.Tornadic.Activity.Beginning = {0} commencant u00e0 {1}\:{2} {3} SM {4} de la station +Remark.Tornadic.Activity.BegEnd = {0} commencant u00e0 {1}\:{2} finissant u00e0 {3}\:{4} {5} SM {6} de la station +Remark.Tornadic.Activity.Ending = {0} finissant u00e0 {1}\:{2} {3} SM {4} de la station +Remark.TORNADO = tornado +Remark.Tower.Visibility = visibility de la tour de contru00f4le de {0} miles +Remark.Variable.Prevailing.Visibility = variation de la visibilitu00e9 dominante entre {0} et {1} SM +Remark.Variable.Sky.Condition = couche de nuages variant entre {0} et {1} +Remark.Variable.Sky.Condition.Height = couche de nuages u00e0 {0} pieds variant entre {1} et {2} +Remark.VIRGA = virga +Remark.Virga.Direction = virga au {0} de la station +Remark.WATERSPOUT = trombe +Remark.WindShift = changement de vent u00e0 {0}\:{1} +Remark.WindShift.FROPA = changement de vent accompagnu00e9 d'un passage de front u00e0 {0}\:{1} +Remark.Snow.Increasing.Rapidly = u00e9paisseur de neige de {0} pouces sur la derniu00e8re heure avec une u00e9paisseur totale au sol de {1} pouces +ToString.airport = au00e9roport +ToString.altimeter = altimu00e8tre (hPa) +ToString.amendment = amendement +ToString.clouds = nuages +ToString.day.month = jour du mois +ToString.day.hour = heure du jour +ToString.descriptive = descriptif +ToString.dew.point = point de rosu00e9e +ToString.end.day.month = jour de fin du mois +ToString.end.hour.day = heure de fin du jour +ToString.height.feet = altitude (pieds) +ToString.height.meter = altitude (m) +ToString.intensity = intensitu00e9 +ToString.message = message original +ToString.name = nom +ToString.phenomenons = phu00e9nomu00e8nes +ToString.probability = probabilitu00e9 +ToString.quantity = quantitu00e9 +ToString.remark = remarques +ToString.report.time = heure du rapport +ToString.runway.info = informations sur la piste +ToString.start.day.month = jour de d/u00e9but du mois +ToString.start.hour.day = heure de d/u00e9but du jour +ToString.start.minute = minute de d/u00e9but +ToString.temperature = tempru00e9rature (°C) +ToString.temperature.max = tempu00e9rature maximale (°C) +ToString.temperature.min = tempu00e9rature minimale (°C) +ToString.trend = tendance +ToString.trends = tendances +ToString.visibility.main = visibilitu00e9 principale +ToString.visibility.min = visibilitu00e9 minimale +ToString.visibility.min.direction = direction de la visibilitu00e9 minimale +ToString.visibility.max = visibilitu00e9 maximale +ToString.vertical.visibility = visibilitu00e9 verticale (pieds) +ToString.weather.conditions = conditions mu00e9tu00e9orologique +ToString.wind.direction.degrees = direction (degru00e9s) +ToString.wind.gusts = rafales +ToString.wind.min.variation = variation minimale du vent +ToString.wind.max.variation = variation maximale du vent +ToString.wind.speed = vitesse +ToString.wind.unit = unitu00e9 +Converter.ENE = Est Nord Est +Converter.ESE = Est Sud Est +Converter.NNE = Nord Nord Est +Converter.NNW = Nord Nord Ouest +Converter.SSE = Sud Sud Est +Converter.SSW = Sud Sud Ouest +Converter.WNW = Ouest Nord Ouest +Converter.WSW = Ouest Sud Ouest +TimeIndicator.FM = De +ToString.auto = +ToString.cavok = +ToString.nosig = +ToString.type = +ToString.wind.direction = \ No newline at end of file diff --git a/metarParser-commons/src/test/java/io/github/mivek/utils/ConverterTest.java b/metarParser-commons/src/test/java/io/github/mivek/utils/ConverterTest.java index d4731f1e..0429102e 100644 --- a/metarParser-commons/src/test/java/io/github/mivek/utils/ConverterTest.java +++ b/metarParser-commons/src/test/java/io/github/mivek/utils/ConverterTest.java @@ -1,25 +1,13 @@ package io.github.mivek.utils; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import io.github.mivek.internationalization.Messages; +import org.junit.Test; import java.time.LocalTime; -import org.junit.Test; - -import io.github.mivek.internationalization.Messages; +import static org.junit.Assert.assertEquals; public class ConverterTest { - @Test - public void testBetween() { - - assertTrue(Converter.isBetween(5, 2, 8)); - assertTrue(Converter.isBetween(5, 5, 8)); - assertFalse(Converter.isBetween(5, 6, 10)); - assertFalse(Converter.isBetween(5, 0, 2)); - } - @Test public void testConvertVisibility() { assertEquals(">10km", Converter.convertVisibility("9999")); diff --git a/metarParser-commons/src/test/java/io/github/mivek/utils/DegreesToDirectionTest.java b/metarParser-commons/src/test/java/io/github/mivek/utils/DegreesToDirectionTest.java index e76921c0..38ab928a 100644 --- a/metarParser-commons/src/test/java/io/github/mivek/utils/DegreesToDirectionTest.java +++ b/metarParser-commons/src/test/java/io/github/mivek/utils/DegreesToDirectionTest.java @@ -26,14 +26,14 @@ public DegreesToDirectionTest(final String pDirection, final String pDegrees) { public static Collection data() { return Arrays.asList(new Object[][] { { "Converter.E", "80" }, - { "Converter.NE", "30" }, - { "Converter.S", "200" }, + { "Converter.NNE", "30" }, + { "Converter.SSW", "200" }, { "Converter.W", "280" }, - { "Converter.NW", "300"}, + { "Converter.WNW", "300"}, { "Converter.SE", "130" }, { "Converter.SW", "230" }, { "Converter.N", "2" }, - { "Converter.N", "345" }, + { "Converter.NNW", "345" }, {"Converter.VRB","anyString"} }); } 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 50cd14a1..5f207d85 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 @@ -28,7 +28,7 @@ public void testParseWindSimple() { Wind res = sut.parseWind(windPart); assertNotNull(res); - assertThat(res.getDirection(), is(Messages.getInstance().getString("Converter.N"))); + assertThat(res.getDirection(), is(Messages.getInstance().getString("Converter.NNW"))); assertEquals(Integer.valueOf(340), res.getDirectionDegrees()); assertEquals(8, res.getSpeed()); assertEquals(0, res.getGust()); @@ -43,7 +43,7 @@ public void testParseWindWithGusts() { Wind res = sut.parseWind(windPart); assertNotNull(res); - assertThat(res.getDirection(), is(Messages.getInstance().getString("Converter.SE"))); + assertThat(res.getDirection(), is(Messages.getInstance().getString("Converter.ESE"))); assertEquals(Integer.valueOf(120), res.getDirectionDegrees()); assertEquals(17, res.getSpeed()); assertEquals(20, res.getGust()); From 8e816abb6bf3721901a93d02de3a9bfb15293949 Mon Sep 17 00:00:00 2001 From: jk KPADEY Date: Sat, 28 Nov 2020 20:14:14 +0100 Subject: [PATCH 2/3] Updated spotbugs and opencsv versions Signed-off-by: jk KPADEY --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8aac8d33..413a064a 100644 --- a/pom.xml +++ b/pom.xml @@ -53,9 +53,9 @@ 4.13.1 2.2 3.8.1 - 4.1.3 + 4.1.4 3.11 - 5.2 + 5.3 1.3.7 0.98 0.96 From 06fa5088afd368d3715ad11e54b2179c187be3f0 Mon Sep 17 00:00:00 2001 From: jk KPADEY Date: Sat, 28 Nov 2020 21:01:08 +0100 Subject: [PATCH 3/3] Fix codefactor issues Signed-off-by: jk KPADEY --- .codeclimate.yml | 2 +- .../src/main/java/io/github/mivek/utils/Converter.java | 2 +- scripts/before_install.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index 9f6c02f0..bce59244 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -30,7 +30,7 @@ checks: identical-code: config: threshold: # language-specific defaults. an override will affect all languag - + plugins: checkstyle: enabled: false diff --git a/metarParser-commons/src/main/java/io/github/mivek/utils/Converter.java b/metarParser-commons/src/main/java/io/github/mivek/utils/Converter.java index 1c1a37c3..3ba26e53 100644 --- a/metarParser-commons/src/main/java/io/github/mivek/utils/Converter.java +++ b/metarParser-commons/src/main/java/io/github/mivek/utils/Converter.java @@ -36,7 +36,7 @@ public static String degreesToDirection(final String degreesStr) { return Messages.getInstance().getString("Converter.VRB"); } - return Messages.getInstance().getString("Converter." + DIRECTIONS[(int)((degrees+11.5)/22.5)]); + return Messages.getInstance().getString("Converter." + DIRECTIONS[(int) ((degrees + 11.5) / 22.5)]); } /** diff --git a/scripts/before_install.sh b/scripts/before_install.sh index e2bf17f2..f611b65f 100644 --- a/scripts/before_install.sh +++ b/scripts/before_install.sh @@ -21,7 +21,7 @@ if [[ "$isPRMerged" = true ]] ; then git config --global user.email "travis@travis-ci.com" git config --global user.name "Travis CI" git add pom.xml - git add **/pom.xml + git add ./**/pom.xml git commit -m "Bump pom" git push https://${TRAVIS_GIT_USER}@github.com/mivek/metarParser.git HEAD:master fi