Created
March 13, 2019 18:14
-
-
Save nimeacuerdo/c80a561e7a07aeb863ab3e3a5580a80e to your computer and use it in GitHub Desktop.
One liner test
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 class DownloadStuffInteractorTest extends UnitTest { | |
private static final String ANY_URL = "http://www.wherever.com"; | |
private static final String ANY_FILE_NAME = "file.pdf"; | |
private static final EmailWithStuff EMAIL = new EmailWithStuff(ANY_URL, ANY_FILE_NAME); | |
@Mock | |
private StuffDownloader StuffDownloader; | |
private DownloadStuffInteractor DownloadStuffInteractor; | |
@Before | |
public void setup() { | |
DownloadStuffInteractor = new DownloadStuffInteractor(StuffDownloader); | |
} | |
@Test | |
public void shouldDownloadFileSilently() { | |
DownloadStuffInteractor.execute(EMAIL); | |
verify(StuffDownloader).silentlyDownloadFile(ANY_URL, ANY_FILE_NAME); | |
} | |
} | |
SUT | |
public DownloadInvoiceInteractor(InvoiceDownloader invoiceDownloader) { | |
this.invoiceDownloader = invoiceDownloader; | |
} | |
public void execute(EmailWithAttachment emailWithAttachment) { | |
invoiceDownloader.downloadFileSilently(emailWithAttachment.getUrl(), emailWithAttachment.getFileName()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment