Skip to content

Commit

Permalink
ifpe-cti#3 testes da classe motorista
Browse files Browse the repository at this point in the history
  • Loading branch information
GuilhermeGz committed Nov 20, 2017
1 parent 8689b65 commit 1661df3
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 5 deletions.
5 changes: 0 additions & 5 deletions Servidor/ZonaAzulDigital/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@
<artifactId>javax.faces</artifactId>
<version>2.2.7</version>
</dependency>
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>all-themes</artifactId>
<version>1.0.8</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.zonaAzulDigital.entidades;

import java.math.BigDecimal;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
*
* @author 20141D12GR0114
*/
public class MotoristaIT {

public MotoristaIT() {
}

@Test
public void testDebitarPositivo() {
Motorista motorista = new Motorista();
motorista.setCredito(BigDecimal.valueOf(11.0));
boolean result = motorista.debitar(BigDecimal.valueOf(10.0));
assertTrue(result);

}

@Test
public void testDebitarNegativo() {
Motorista motorista = new Motorista();
motorista.setCredito(BigDecimal.valueOf(9.0));
boolean result = motorista.debitar(BigDecimal.valueOf(10.0));
assertFalse(result);

}

@Test
public void testCreditarAumetando() {
Motorista motorista = new Motorista();
motorista.setCredito(BigDecimal.valueOf(10.0));
boolean result = motorista.creditar(BigDecimal.valueOf(5.0));
assertTrue(result);
}

@Test
public void testCreditarSemAumento() {
Motorista motorista = new Motorista();
motorista.setCredito(BigDecimal.valueOf(10.0));
boolean result = motorista.creditar(BigDecimal.valueOf(0.0));
assertFalse(result);
}

@Test(expected = IllegalArgumentException.class)
public void testCreditarValorNegativo() {
Motorista motorista = new Motorista();
motorista.setCredito(BigDecimal.valueOf(0.0));
boolean result = motorista.creditar(BigDecimal.valueOf(-5.0));
}

}

0 comments on commit 1661df3

Please sign in to comment.