Skip to content

Instantly share code, notes, and snippets.

@GuilhermeManzano
Created November 20, 2020 03:20
Show Gist options
  • Save GuilhermeManzano/bdbd585c56495a75f5faaae1d6f6ce69 to your computer and use it in GitHub Desktop.
Save GuilhermeManzano/bdbd585c56495a75f5faaae1d6f6ce69 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(5.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