* Update HtmlUnitAndJUnitTest.java

* Update HtmlUnitWebScraping.java

* Update HtmlUnitAndSpringTest.java

* Create message.html

* Update HtmlUnitAndJUnitTest.java

* Delete HtmlUnitAndSpringIntegrationTest.java

* Delete HtmlUnitTest.java
This commit is contained in:
Juan García Heredero
2016-11-28 18:43:10 +01:00
committed by Grzegorz Piwowarek
parent 678e47dc1a
commit 977333c9a3
6 changed files with 131 additions and 115 deletions

View File

@@ -0,0 +1,31 @@
package com.baeldung.htmlunit;
import org.junit.Assert;
import org.junit.Test;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
public class HtmlUnitAndJUnitTest {
@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());
}
}