Skip to content

Instantly share code, notes, and snippets.

@plagelao
Created November 23, 2010 23:32
Show Gist options
  • Save plagelao/712774 to your computer and use it in GitHub Desktop.
Save plagelao/712774 to your computer and use it in GitHub Desktop.
Banco que depende de Cajero
public class Banco {
private final OperacionesBancarias operacionesBancarias;
private final Cajero cajero;
public Banco(OperacionesBancarias operacionesBancarias,
Cajero cajero) {
this.operacionesBancarias = operacionesBancarias;
this.cajero = cajero;
}
public void obtenerCuenta(Credenciales credenciales) {
try {
Token token = operacionesBancarias.autenticar(credenciales);
cajero.cuentaObtenida(Cuenta.crear(token));
} catch (AccesoInvalidadoPorMultiplesReintentosFallidos e) {
cajero.cuentaAnulada()
} catch (CredencialesIncorrectas e) {
cajero.credencialesIncorrectas();
} catch (BancoInaccesible e) {
cajero.bancoInaccesible();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment