-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
altera regra de estimativa valida e cria metodo para ver se tem mensa…
…gem atencao
- Loading branch information
1 parent
41b21c3
commit f790cc3
Showing
4 changed files
with
127 additions
and
6 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
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
48 changes: 48 additions & 0 deletions
48
src/test/java/br/com/correios/estimativa/EstimativaComPrazoTest.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,48 @@ | ||
package br.com.correios.estimativa; | ||
|
||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class EstimativaComPrazoTest { | ||
|
||
private EstimativaComPrazo estimativaComPrazo; | ||
|
||
@Before | ||
public void setUp() { | ||
estimativaComPrazo = new EstimativaComPrazo(); | ||
} | ||
|
||
@Test | ||
public void deveriaMostrarEstimativaInvalidaESemMensagemDeAtencaoQuandoPrazoDeEntregaForZeroETiverMensagemErro() { | ||
estimativaComPrazo.setPrazoEntrega(0); | ||
estimativaComPrazo.setCodigoErro("001"); | ||
estimativaComPrazo.setMensagemErro("Codigo de servico invalido."); | ||
|
||
assertFalse(estimativaComPrazo.isEstimativaValida()); | ||
assertFalse(estimativaComPrazo.possuiMensagemAtencao()); | ||
} | ||
|
||
@Test | ||
public void deveriaMostrarEstimativaValidaEComMensagemDeAtencaoQuandoPrazoDeEntregaForValidoETiverMensagemErro() { | ||
estimativaComPrazo.setPrazoEntrega(5); | ||
estimativaComPrazo.setCodigoErro("010"); | ||
estimativaComPrazo.setMensagemErro("Area de Risco"); | ||
|
||
assertTrue(estimativaComPrazo.isEstimativaValida()); | ||
assertTrue(estimativaComPrazo.possuiMensagemAtencao()); | ||
} | ||
|
||
@Test | ||
public void deveriaMostrarEstimativaValidaESemMensagemDeAtencaoQuandoPrazoDeEntregaForValidoENaoTiverMensagemErro() { | ||
estimativaComPrazo.setPrazoEntrega(5); | ||
estimativaComPrazo.setCodigoErro("0"); | ||
estimativaComPrazo.setMensagemErro(""); | ||
|
||
assertTrue(estimativaComPrazo.isEstimativaValida()); | ||
assertFalse(estimativaComPrazo.possuiMensagemAtencao()); | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
src/test/java/br/com/correios/estimativa/EstimativaComPrecoEPrazoTest.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,51 @@ | ||
package br.com.correios.estimativa; | ||
|
||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class EstimativaComPrecoEPrazoTest { | ||
|
||
private EstimativaComPrecoEPrazo estimativaComPrecoEPrazo; | ||
|
||
@Before | ||
public void setUp() { | ||
estimativaComPrecoEPrazo = new EstimativaComPrecoEPrazo(); | ||
} | ||
|
||
@Test | ||
public void deveriaMostrarEstimativaInvalidaESemMensagemDeAtencaoQuandoPrazoDeEntregaForZeroETiverMensagemErro() { | ||
estimativaComPrecoEPrazo.setValor("0"); | ||
estimativaComPrecoEPrazo.setPrazoEntrega(0); | ||
estimativaComPrecoEPrazo.setCodigoErro("001"); | ||
estimativaComPrecoEPrazo.setMensagemErro("Codigo de servico invalido."); | ||
|
||
assertFalse(estimativaComPrecoEPrazo.isEstimativaValida()); | ||
assertFalse(estimativaComPrecoEPrazo.possuiMensagemAtencao()); | ||
} | ||
|
||
@Test | ||
public void deveriaMostrarEstimativaValidaEComMensagemDeAtencaoQuandoPrazoDeEntregaForValidoETiverMensagemErro() { | ||
estimativaComPrecoEPrazo.setValor("17,20"); | ||
estimativaComPrecoEPrazo.setPrazoEntrega(5); | ||
estimativaComPrecoEPrazo.setCodigoErro("010"); | ||
estimativaComPrecoEPrazo.setMensagemErro("Area de Risco"); | ||
|
||
assertTrue(estimativaComPrecoEPrazo.isEstimativaValida()); | ||
assertTrue(estimativaComPrecoEPrazo.possuiMensagemAtencao()); | ||
} | ||
|
||
@Test | ||
public void deveriaMostrarEstimativaValidaESemMensagemDeAtencaoQuandoPrazoDeEntregaForValidoENaoTiverMensagemErro() { | ||
estimativaComPrecoEPrazo.setValor("17,20"); | ||
estimativaComPrecoEPrazo.setPrazoEntrega(5); | ||
estimativaComPrecoEPrazo.setCodigoErro("0"); | ||
estimativaComPrecoEPrazo.setMensagemErro(""); | ||
|
||
assertTrue(estimativaComPrecoEPrazo.isEstimativaValida()); | ||
assertFalse(estimativaComPrecoEPrazo.possuiMensagemAtencao()); | ||
} | ||
|
||
} |