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
package com.blogspot.plagelao.contracttest.implementaciones; | |
import com.blogspot.plagelao.contracttest.ContratoParaColecciones; | |
import java.util.Collection; | |
import java.util.HashSet; | |
import junit.framework.Test; | |
public class HashSetTest extends ContratoParaColecciones { | |
public HashSetTest() { |
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
package com.blogspot.plagelao.contracttest; | |
import java.util.Collection; | |
import org.junit.Before; | |
import org.junit.Test; | |
import static org.junit.Assert.*; | |
public abstract class ContratoParaColecciones { | |
public ContratoParaColecciones() { |
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
package com.blogspot.plagelao.contracttest.implementaciones; | |
import com.blogspot.plagelao.contracttest.ContratoParaColecciones; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
public class ArrayListTest extends ContratoParaColecciones { | |
public ArrayListTest() { | |
} |
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
@Test | |
public void insertarElMismoElementoDosVecesAumentaLaLongitudEnDosUniddes() { | |
Object objeto = new Object(); | |
collection.add(objeto); | |
assertEquals("Añadir un elemento aumenta en 1 su tamaño", 1, collection.size()); | |
collection.add(objeto); | |
assertEquals("Añadir de nuevo el mismo elemento aumenta en 1 su tamaño", 2, collection.size()); | |
} |
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 Banco { | |
private final OperacionesBancarias operacionesBancarias; | |
public Banco(OperacionesBancarias operacionesBancarias) { | |
this.operacionesBancarias = operacionesBancarias; | |
} | |
public Cuenta obtenerCuenta(String usuario, Pin pin) { | |
String token = operacionesBancarias.autenticarUsuario(usuario, pin); |
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 Banco { | |
private final Conector conector; | |
private final GeneradorToken generadorToken; | |
public Banco(Conector conector, GeneradorToken generadorToken) { | |
this.conector = conector; | |
this.generadorToken = generadorToken; | |
} |
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 Banco { | |
private final OperacionesBancarias operacionesBancarias; | |
public Banco(OperacionesBancarias operacionesBancarias) { | |
this.operacionesBancarias = operacionesBancarias; | |
} | |
public Cuenta obtenerCuenta(String usuario, Pin pin) { | |
Token token = operacionesBancarias.autenticarUsuario(usuario, pin); |
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 Banco { | |
private final OperacionesBancarias operacionesBancarias; | |
private final InteresadoEnAccesoACuenta suscriptor; | |
public Banco(OperacionesBancarias operacionesBancarias, | |
InteresadoEnAccesoACuenta suscriptor) { | |
this.operacionesBancarias = operacionesBancarias; | |
this.suscriptor = suscriptor; | |
} |
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 Cajero { | |
public void muestraLaPantallaPrincipal() { | |
try { | |
Banco banco = new Banco(new OperacionesBancariasBancoManolito()); | |
Credenciales credenciales = obtenCredenciales(); | |
Cuenta cuenta = banco.obtenerCuenta(credenciales); | |
muestraInformacionDeLacuenta(cuenta); | |
} catch (AccesoInvalidadoPorMultiplesReintentosFallidos e) { |
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 Cajero implements InteresadoEnAccesoACuenta { | |
public void muestraLaPantallaPrincipal() { | |
Banco banco = new Banco(new OperacionesBancariasBancoManolito(), | |
this); | |
banco.obtenerCuenta(obtenCredenciales()); | |
} | |
public void cuentaObtenida(Cuenta cuenta) { | |
mostrarInformacionDeLacuenta(cuenta); |
OlderNewer