forked from ifpe-cti/zonaAzulDigital
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ifpe-cti#3 testes da classe motorista
- Loading branch information
1 parent
8689b65
commit 1661df3
Showing
2 changed files
with
66 additions
and
5 deletions.
There are no files selected for viewing
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
66 changes: 66 additions & 0 deletions
66
Servidor/ZonaAzulDigital/src/test/java/com/zonaAzulDigital/entidades/MotoristaIT.java
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
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)); | ||
} | ||
|
||
} |