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
Set<String> cesta = new HashSet(); | |
cesta.add("manzana"); | |
cesta.add("platano"); | |
cesta.add("fresa"); | |
assertThat(cesta, anyOf(hasItem("manzana"), | |
hasItem("pera"))); |
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
Expected: (a collection containing "manzana" or a collection containing "pera") | |
got: <[kiwi, fresa, platano]> | |
) |
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 EmailNotifierTest { | |
static final String TEST_BODY = "cuerpo de test"; | |
static final String TEST_SUBJECT = "asunto de test"; | |
final MailAdress alfredo = new MailAdress("[email protected]"); | |
final EmailNotifier emailNotifier = new EmailNotifier(); | |
@Test | |
public void shouldSendOneEmailToTheGivenEmailAdress() throws Exception { |
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 MailTestMatchersAndUtilities { | |
public static Inbox inboxOf(final MailAdress userMailAdress) throws Exception { | |
return new Inbox(userMailAdress); | |
} | |
public static TypeSafeMatcher<Inbox> hasOneEmailWithSubject(final String expectedSubject) { | |
return new TypeSafeMatcher<Inbox>() { | |
@Override | |
public boolean matchesSafely(Inbox inbox) { |
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
Expected: a message with subject: "test subject", in inbox | |
got: <Mails in inbox: 1 [subject: bad subject] > | |
) |
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 Inbox { | |
public static final String INBOX = "INBOX"; | |
public static final String POP3 = "pop3"; | |
public Message[] inboxMessages; | |
public Inbox(final MailAdress mailAdress) throws Exception { | |
Folder folder = openInboxFolder(mailAdress); | |
inboxMessages = folder.getMessages(); | |
} |
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 Producto { | |
private int precio; | |
public int getPrecio() { | |
return precio; | |
} | |
public void setPrecio(int precio) { | |
this.precio = precio; |
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 Producto { | |
private int precio; | |
public int precio() { | |
return precio; | |
} | |
} |
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 Descuento { | |
private int porcentajeDeDescuento; | |
public int getPorcentajeDeDescuento() { | |
return porcentajeDeDescuento; | |
} | |
public void setPorcentajeDeDescuento(int porcentajeDeDescuento) { | |
this.porcentajeDeDescuento = porcentajeDeDescuento; |
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 Descuento { | |
private int porcentajeDeDescuento; | |
public int aplicar(int precioAntesDeAplicarDescuento) { | |
return (porcentajeDeDescuento/100)*precioAntesDeAplicarDescuento; | |
} | |
} |