Created
          January 13, 2018 04:23 
        
      - 
      
- 
        Save HashRaygoza/4d8bce51a56a2106480c900d510a3fad to your computer and use it in GitHub Desktop. 
    Prueba de unidad para demostrar jUnit 5
  
        
  
    
      This file contains hidden or 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 mx.calculoTest; | |
| import mx.calculo.Calculo; | |
| import org.junit.*; | |
| import static org.junit.jupiter.api.Assertions.assertEquals; | |
| import static org.junit.jupiter.api.Assertions.assertTrue; | |
| public class CalculoTest { | |
| @BeforeClass | |
| public static void setUpBeforeClass() throws Exception { | |
| } | |
| @AfterClass | |
| public static void tearDownAfterClass() throws Exception { | |
| } | |
| /** | |
| Con esta prueba verificaremos que jUnit este funcionando | |
| */ | |
| @Test | |
| public void pruebaJUnit() { | |
| assertTrue(true); | |
| } | |
| @Test | |
| public void pruebaCalculo() { | |
| Calculo calculo = new Calculo(); | |
| assertEquals(1.0, calculo.calcular(1.0)); | |
| assertEquals(4.0, calculo.calcular(2.0)); | |
| assertEquals(9.0, calculo.calcular(3.0)); | |
| assertEquals(16.0, calculo.calcular(4.0)); | |
| assertEquals(25.0, calculo.calcular(5.0)); | |
| } | |
| @Test | |
| public void pruebaIVA() { | |
| Calculo calculo = new Calculo(); | |
| assertEquals(1.6, calculo.calcularIVA(10)); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment