Remove Apache Commons IO dependency and split into smaller methods (#942)
* Fix the requested changes * Split into smaller methods * Split into smaller methods * Remove apache dependency and split into smaller methods * Add unit tests
This commit is contained in:
committed by
KevinGilmore
parent
729c8990d0
commit
6a60defc94
36
jsoup/src/test/java/com/baeldung/jsoup/JsoupParserTest.java
Normal file
36
jsoup/src/test/java/com/baeldung/jsoup/JsoupParserTest.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.baeldung.jsoup;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.jsoup.HttpStatusException;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class JsoupParserTest {
|
||||
|
||||
JsoupParser jsoupParser;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
jsoupParser = new JsoupParser();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test404() throws IOException {
|
||||
try {
|
||||
jsoupParser.loadDocument("https://spring.io/will-not-be-found");
|
||||
} catch (HttpStatusException ex) {
|
||||
assertEquals(404, ex.getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testChange() throws IOException {
|
||||
jsoupParser.loadDocument("http://spring.io/blog");
|
||||
|
||||
jsoupParser.examplesModifying();
|
||||
|
||||
assertTrue(jsoupParser.getTidyHtml().contains("http://baeldung.com"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user