Skip to content

Instantly share code, notes, and snippets.

@GuilhermeManzano
Created November 20, 2020 03:17
Show Gist options
  • Save GuilhermeManzano/86996a20e4b950fd497bc0d557a3fb53 to your computer and use it in GitHub Desktop.
Save GuilhermeManzano/86996a20e4b950fd497bc0d557a3fb53 to your computer and use it in GitHub Desktop.
public class LocacaoServiceTest {
@Rule
public ErrorCollector error = new ErrorCollector();
@Test
public void teste() throws Exception {
// cenario
LocacaoService service = new LocacaoService();
Usuario usuario = new Usuario("Usuario 1");
Filme filme = new Filme("Filme 1", 2, 4.0);
// açao
Locacao locacao = service.alugarFilme(usuario, filme);
// verificacao
error.checkThat(locacao.getValor(), is(equalTo(4.0)));
error.checkThat(isMesmaData(locacao.getDataLocacao(), new Date()), is(true));
error.checkThat(isMesmaData(locacao.getDataRetorno(), DataUtils.obterDataComDiferencaDias(1)), is(true));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment