Created
January 23, 2011 21:07
-
-
Save AlfredoCasado/792441 to your computer and use it in GitHub Desktop.
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
public class CompraTestSpies { | |
PasarelaDePago pasarelaDePagoSpy = mock(PasarelaDePago.class); | |
Producto unProductoStub = mock(Producto.class); | |
Compra compra = new Compra(pasarelaDePagoSpy); | |
@Test public void | |
si_el_cliente_tiene_fondos_para_realizar_la_compra_tengo_que_cobrarle_a_traves_de_la_pasarela_de_pago() { | |
when(unProductoStub.precio()).thenReturn(50); | |
when(pasarelaDePagoSpy.tieneElUsuarioFondosPorValorDe(50)).thenReturn(false); | |
compra.anadir(unProductoStub); | |
compra.confirmar(); | |
verify(pasarelaDePagoSpy).cobrar(50); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment