From 6a14f92d5cdd2a5bafb2d6b71a47e3f9e9db2961 Mon Sep 17 00:00:00 2001 From: Carlos Vasquez Polanco Date: Thu, 2 Oct 2014 08:12:09 -0400 Subject: [PATCH] =?UTF-8?q?Refactorizando=20de=20Gasolina=20a=20Combustibl?= =?UTF-8?q?e=20como=20nombre=20m=C3=A1s=20coherente=20e=20incrementando=20?= =?UTF-8?q?la=20versi=C3=B3n=20de=20proyecto=20a=200.7.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../{Gasolina.java => Combustibles.java} | 22 ++++++++-------- .../org/devdom/commons/service/RSSParser.java | 26 +++++++++---------- ...asolinaTest.java => CombustiblesTest.java} | 18 ++++++------- 4 files changed, 34 insertions(+), 34 deletions(-) rename src/main/java/org/devdom/commons/{Gasolina.java => Combustibles.java} (86%) rename src/test/java/org/devdom/commons/{GasolinaTest.java => CombustiblesTest.java} (82%) diff --git a/pom.xml b/pom.xml index d700543..429c653 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.devdom commons-do - 0.7.6 + 0.7.8 jar UTF-8 diff --git a/src/main/java/org/devdom/commons/Gasolina.java b/src/main/java/org/devdom/commons/Combustibles.java similarity index 86% rename from src/main/java/org/devdom/commons/Gasolina.java rename to src/main/java/org/devdom/commons/Combustibles.java index 160aa1b..a37cae7 100644 --- a/src/main/java/org/devdom/commons/Gasolina.java +++ b/src/main/java/org/devdom/commons/Combustibles.java @@ -34,7 +34,7 @@ * @author Carlos Vásquez Polanco * @since 0.6.7 */ -public class Gasolina { +public class Combustibles { private final RSSParser parser; private final Feed feed; @@ -51,7 +51,7 @@ public class Gasolina { * * @throws MalformedXMLException */ - public Gasolina() throws MalformedXMLException { + public Combustibles() throws MalformedXMLException { this.parser = new RSSParser(); feed = parser.getResult(); } @@ -89,19 +89,19 @@ public String getTitle(){ } /** - * Obtener el precio de la Gasolina Premium en la República Dominicana + * Obtener el precio de la Combustibles Premium en la República Dominicana * @return */ public double getCurrentGasolinaPremiumPrice(){ - return get(Gasolina.GASOIL_PREMIUM); + return get(Combustibles.GASOIL_PREMIUM); } /** - * Obtener el precio de la Gasolina Regular en la República Dominicana + * Obtener el precio de la Combustibles Regular en la República Dominicana * @return */ public double getCurrentGasolinaRegularPrice(){ - return get(Gasolina.GASOIL_REGULAR); + return get(Combustibles.GASOIL_REGULAR); } /** @@ -109,7 +109,7 @@ public double getCurrentGasolinaRegularPrice(){ * @return */ public double getCurrentGasoilPremiumPrice(){ - return get(Gasolina.GASOIL_PREMIUM); + return get(Combustibles.GASOIL_PREMIUM); } /** @@ -117,7 +117,7 @@ public double getCurrentGasoilPremiumPrice(){ * @return */ public double getCurrentGasoilRegularPrice(){ - return get(Gasolina.GASOIL_REGULAR); + return get(Combustibles.GASOIL_REGULAR); } /** @@ -125,7 +125,7 @@ public double getCurrentGasoilRegularPrice(){ * @return */ public double getCurrentKerosenePrice(){ - return get(Gasolina.KEROSENE); + return get(Combustibles.KEROSENE); } /** @@ -133,7 +133,7 @@ public double getCurrentKerosenePrice(){ * @return */ public double getCurrentGasLicuadoDePetroleo(){ - return get(Gasolina.GAS_LICUADO_DE_PETROLEO); + return get(Combustibles.GAS_LICUADO_DE_PETROLEO); } /** @@ -141,7 +141,7 @@ public double getCurrentGasLicuadoDePetroleo(){ * @return */ public double getCurrentGasNautralVehicular(){ - return get(Gasolina.GAS_NATURAL_VEHICULAR); + return get(Combustibles.GAS_NATURAL_VEHICULAR); } } \ No newline at end of file diff --git a/src/main/java/org/devdom/commons/service/RSSParser.java b/src/main/java/org/devdom/commons/service/RSSParser.java index 809dcf8..9b0271e 100644 --- a/src/main/java/org/devdom/commons/service/RSSParser.java +++ b/src/main/java/org/devdom/commons/service/RSSParser.java @@ -32,7 +32,7 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.Characters; import javax.xml.stream.events.XMLEvent; -import org.devdom.commons.Gasolina; +import org.devdom.commons.Combustibles; import org.devdom.commons.dto.Feed; import org.devdom.commons.exceptions.MalformedXMLException; import org.devdom.commons.util.Configuration; @@ -105,27 +105,27 @@ private String getCharacterData(XMLEvent event, XMLEventReader eventReader) */ public String getProperty(Feed feed, String item){ - if(item.equals(Gasolina.GASOIL_PREMIUM)){ + if(item.equals(Combustibles.GASOIL_PREMIUM)){ return feed.getGasoilp(); } - if(item.equals(Gasolina.GASOIL_REGULAR)){ + if(item.equals(Combustibles.GASOIL_REGULAR)){ return feed.getGasoilr(); } - if(item.equals(Gasolina.GASOLINA_PREMIUM)){ + if(item.equals(Combustibles.GASOLINA_PREMIUM)){ return feed.getGas95(); } - if(item.equals(Gasolina.GASOLINA_REGULAR)){ + if(item.equals(Combustibles.GASOLINA_REGULAR)){ return feed.getGas89(); } - if(item.equals(Gasolina.GAS_LICUADO_DE_PETROLEO)){ + if(item.equals(Combustibles.GAS_LICUADO_DE_PETROLEO)){ return feed.getGlp(); } - if(item.equals(Gasolina.GAS_NATURAL_VEHICULAR)){ + if(item.equals(Combustibles.GAS_NATURAL_VEHICULAR)){ return feed.getGnv(); } @@ -147,27 +147,27 @@ public String getProperty(Feed feed, String item){ */ private void setProperty(Feed feed, String item, String value) { - if(item.equals(Gasolina.GASOIL_PREMIUM)){ + if(item.equals(Combustibles.GASOIL_PREMIUM)){ feed.setGasoilp(value); } - if(item.equals(Gasolina.GASOIL_REGULAR)){ + if(item.equals(Combustibles.GASOIL_REGULAR)){ feed.setGasoilr(value); } - if(item.equals(Gasolina.GASOLINA_PREMIUM)){ + if(item.equals(Combustibles.GASOLINA_PREMIUM)){ feed.setGas95(value); } - if(item.equals(Gasolina.GASOLINA_REGULAR)){ + if(item.equals(Combustibles.GASOLINA_REGULAR)){ feed.setGas89(value); } - if(item.equals(Gasolina.GAS_LICUADO_DE_PETROLEO)){ + if(item.equals(Combustibles.GAS_LICUADO_DE_PETROLEO)){ feed.setGlp(value); } - if(item.equals(Gasolina.GAS_NATURAL_VEHICULAR)){ + if(item.equals(Combustibles.GAS_NATURAL_VEHICULAR)){ feed.setGnv(value); } diff --git a/src/test/java/org/devdom/commons/GasolinaTest.java b/src/test/java/org/devdom/commons/CombustiblesTest.java similarity index 82% rename from src/test/java/org/devdom/commons/GasolinaTest.java rename to src/test/java/org/devdom/commons/CombustiblesTest.java index 15ea05c..33892bf 100644 --- a/src/test/java/org/devdom/commons/GasolinaTest.java +++ b/src/test/java/org/devdom/commons/CombustiblesTest.java @@ -35,21 +35,21 @@ * * @author Carlos Vásquez Polanco */ -public class GasolinaTest { +public class CombustiblesTest { - private Gasolina gasolina; + private Combustibles gasolina; private Feed feed; - public GasolinaTest() { + public CombustiblesTest() { } @Before public void setUp() throws MalformedXMLException { - gasolina = new Gasolina(); + gasolina = new Combustibles(); } /** - * Test of getCurrentPrices method, of class Gasolina. + * Test of getCurrentPrices method, of class Combustibles. */ @Test public void testGetCurrentPrices() { @@ -59,19 +59,19 @@ public void testGetCurrentPrices() { } /** - * Test of getCurrentGasolinaPremiumPrice method, of class Gasolina. + * Test of getCurrentGasolinaPremiumPrice method, of class Combustibles. */ @Test public void testGetCurrentGasolinaPremiumPrice() { - assertTrue("No retornó precio para la gasolina premium", gasolina.get(Gasolina.GASOLINA_PREMIUM)>0); + assertTrue("No retornó precio para la gasolina premium", gasolina.get(Combustibles.GASOLINA_PREMIUM)>0); } /** - * Test of getCurrentGasolinaRegularPrice method, of class Gasolina. + * Test of getCurrentGasolinaRegularPrice method, of class Combustibles. */ @Test public void testGetCurrentGasolinaRegularPrice() { - assertTrue("No retornó precio para la gasolina regular", gasolina.get(Gasolina.GASOLINA_REGULAR)>0); + assertTrue("No retornó precio para la gasolina regular", gasolina.get(Combustibles.GASOLINA_REGULAR)>0); } }