Created
January 22, 2011 19:28
-
-
Save AlfredoCasado/791377 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public class CompraTestMocks { | |
PasarelaDePago pasarelaDePagoMock = createMock(PasarelaDePago.class); | |
Producto unProductoStub = createMock(Producto.class); | |
Compra compra = new Compra(pasarelaDePagoMock); | |
@Test public void | |
si_el_cliente_tiene_fondos_para_realizar_la_compra_tengo_que_cobrarle_a_traves_de_la_pasarela_de_pago() { | |
expect(unProductoStub.precio()).andReturn(50); | |
expect(pasarelaDePagoMock.tieneElUsuarioFondosPorValorDe(50)).andReturn(true); | |
pasarelaDePagoMock.cobrar(50); | |
replay(pasarelaDePagoMock); | |
replay(unProductoStub); | |
compra.anadir(unProductoStub); | |
compra.confirmar(); | |
verify(pasarelaDePagoMock); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment