Created
November 23, 2010 23:32
-
-
Save plagelao/712774 to your computer and use it in GitHub Desktop.
Banco que depende de Cajero
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 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