Skip to content

Commit

Permalink
refactoring integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rajagopal28 committed Dec 18, 2019
1 parent da4e484 commit 9bab993
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.rm.monzo.app.service.CrawlerService;
import com.rm.monzo.app.util.TestStubUtil;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

Expand All @@ -15,13 +16,15 @@ public class CrawlerIntegrationTest {
@Rule
public WireMockRule wireMockRule = new WireMockRule(WireMockConfiguration.wireMockConfig().port(8065));

@Test
public void crawlURLSameDomainOnly() throws Exception {
@Before
public void setupSite() {
TestStubUtil.stubURIWithFilename("/", "index.html");
TestStubUtil.stubURIWithFilename("/page2", "page2.html");
TestStubUtil.stubURIWithFilename("/page3", "page3.html");
TestStubUtil.stubURIWithFilename("/page4", "page4.html");

}
@Test
public void crawlURLSameDomainOnly() throws Exception {
CrawlerService crawlerService = new CrawlerService(4, 10, false);
crawlerService.crawlSite("http://127.0.0.1:8065/", (s, e) -> {
Assert.assertFalse(e.isPresent());
Expand Down Expand Up @@ -55,11 +58,6 @@ public void crawlURLSameDomainOnly() throws Exception {

@Test
public void crawlURLExternalDomainAllowed() throws Exception {
TestStubUtil.stubURIWithFilename("/", "index.html");
TestStubUtil.stubURIWithFilename("/page2", "page2.html");
TestStubUtil.stubURIWithFilename("/page3", "page3.html");
TestStubUtil.stubURIWithFilename("/page4", "page4.html");

CrawlerService crawlerService = new CrawlerService(3, 10, true);
crawlerService.crawlSite("http://127.0.0.1:8065/", (s, e) -> {
Assert.assertFalse(e.isPresent());
Expand Down

0 comments on commit 9bab993

Please sign in to comment.