Skip to content

Instantly share code, notes, and snippets.

@AlfredoCasado
Created January 12, 2011 14:14
Show Gist options
  • Save AlfredoCasado/776199 to your computer and use it in GitHub Desktop.
Save AlfredoCasado/776199 to your computer and use it in GitHub Desktop.
Ejemplo stub a mano
@Test public void
al_confirmar_la_compra_me_devuelve_el_importe_cobrado_usuario_sin_usar_mockito() {
Producto productoStubCreadoManualmente = new Producto() {
@Override
public int precio() {
return PRECIO_DEL_UNICO_PRODUCTO_COMPRADO;
}
};
compra.anadir(productoStubCreadoManualmente);
int dineroCobradoAlUsuario = compra.confirmar();
assertThat(dineroCobradoAlUsuario, is(equalTo(PRECIO_DEL_UNICO_PRODUCTO_COMPRADO)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment