Skip to content

Commit

Permalink
Refactorizando de Gasolina a Combustible como nombre más coherente e …
Browse files Browse the repository at this point in the history
…incrementando la versión de proyecto a 0.7.8
  • Loading branch information
carlosvasquez committed Oct 2, 2014
1 parent 38b872c commit 6a14f92
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.devdom</groupId>
<artifactId>commons-do</artifactId>
<version>0.7.6</version>
<version>0.7.8</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -51,7 +51,7 @@ public class Gasolina {
*
* @throws MalformedXMLException
*/
public Gasolina() throws MalformedXMLException {
public Combustibles() throws MalformedXMLException {
this.parser = new RSSParser();
feed = parser.getResult();
}
Expand Down Expand Up @@ -89,59 +89,59 @@ 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);
}

/**
* Obtener el precio del Gasoil Premium en la República Dominicana
* @return
*/
public double getCurrentGasoilPremiumPrice(){
return get(Gasolina.GASOIL_PREMIUM);
return get(Combustibles.GASOIL_PREMIUM);
}

/**
* Obtener el precio del Gasoil Regular en la República Dominicana
* @return
*/
public double getCurrentGasoilRegularPrice(){
return get(Gasolina.GASOIL_REGULAR);
return get(Combustibles.GASOIL_REGULAR);
}

/**
* Obtener el precio del Kerosene en la República Dominicana
* @return
*/
public double getCurrentKerosenePrice(){
return get(Gasolina.KEROSENE);
return get(Combustibles.KEROSENE);
}

/**
* Obtener el precio del Gas Licuado De Petroleo en la República Dominicana
* @return
*/
public double getCurrentGasLicuadoDePetroleo(){
return get(Gasolina.GAS_LICUADO_DE_PETROLEO);
return get(Combustibles.GAS_LICUADO_DE_PETROLEO);
}

/**
* Obtener el precio del Gas Natural Vehicular en la República Dominicana
* @return
*/
public double getCurrentGasNautralVehicular(){
return get(Gasolina.GAS_NATURAL_VEHICULAR);
return get(Combustibles.GAS_NATURAL_VEHICULAR);
}

}
26 changes: 13 additions & 13 deletions src/main/java/org/devdom/commons/service/RSSParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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);
}

}

0 comments on commit 6a14f92

Please sign in to comment.