cleanup work

This commit is contained in:
eugenp
2016-12-18 22:04:12 +02:00
parent 43f407e6e7
commit e84137bdfc
10 changed files with 169 additions and 254 deletions

View File

@@ -203,6 +203,7 @@
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
<testFailureIgnore>true</testFailureIgnore>
<systemPropertyVariables>
<!-- <provPersistenceTarget>h2</provPersistenceTarget> -->
</systemPropertyVariables>

View File

@@ -0,0 +1,32 @@
package com.baeldung.htmlunit;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
public class HtmlUnitAndJUnitLiveTest {
private WebClient webClient;
@Before
public void init() throws Exception {
webClient = new WebClient();
}
@After
public void close() throws Exception {
webClient.close();
}
@Test
public void givenAClient_whenEnteringBaeldung_thenPageTitleIsOk() throws Exception {
webClient.getOptions().setThrowExceptionOnScriptError(false);
HtmlPage page = webClient.getPage("http://www.baeldung.com/");
Assert.assertEquals("Baeldung | Java, Spring and Web Development tutorials", page.getTitleText());
}
}

View File

@@ -1,34 +0,0 @@
package com.baeldung.htmlunit;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class HtmlUnitAndJUnitTest {
private WebClient webClient;
@Before
public void init() throws Exception {
webClient = new WebClient();
}
@After
public void close() throws Exception {
webClient.close();
}
@Test
public void givenAClient_whenEnteringBaeldung_thenPageTitleIsOk()
throws Exception {
webClient.getOptions().setThrowExceptionOnScriptError(false);
HtmlPage page = webClient.getPage("http://www.baeldung.com/");
Assert.assertEquals(
"Baeldung | Java, Spring and Web Development tutorials",
page.getTitleText());
}
}

View File

@@ -20,7 +20,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = { TestConfig.class })
public class HtmlUnitAndSpringTest {
public class HtmlUnitAndSpringLiveTest {
@Autowired
private WebApplicationContext wac;

View File

@@ -12,7 +12,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
import com.gargoylesoftware.htmlunit.html.HtmlHeading1;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
public class HtmlUnitWebScraping {
public class HtmlUnitWebLiveScraping {
private WebClient webClient;