Created
May 3, 2012 15:54
-
-
Save delucas/2586753 to your computer and use it in GitHub Desktop.
#tallerweb - Rango y pruebas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ar.edu.unlam.tallerweb.eclipse; | |
public class Rango { | |
private int minimo; | |
private int maximo; | |
public Rango(int minimo, int maximo){ | |
this.minimo = minimo; | |
this.maximo = maximo; | |
} | |
public boolean contiene(int valor){ | |
boolean retorno = false; | |
if(valor >= this.minimo | |
&& valor <= this.maximo){ | |
retorno = true; | |
} | |
return retorno; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ar.edu.unlam.tallerweb.eclipse; | |
import org.junit.Assert; | |
import org.junit.Test; | |
public class RangoTests { | |
@Test | |
public void cuandoElNumeroEstaEnElRangoEsVerdadero(){ | |
Rango ernestor = new Rango(0, 9); | |
int numero = 4; | |
Assert.assertTrue(ernestor.contiene(numero)); | |
} | |
@Test | |
public void cuandoElNumeroNoEstaEnElRangoEsFalso(){ | |
Rango rango = new Rango(0, 9); | |
int numero = 10; | |
Assert.assertFalse(rango.contiene(numero)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment