Skip to content

Commit a97abc3

Browse files
committed
test format
1 parent 5160d12 commit a97abc3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/test/java/im/nll/data/extractor/ExtractorsTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ public void testGet() throws Exception {
4343
String followers = Extractors.on(baseHtml).extract(selector("div.followers")).with(regex("\\d+")).asString();
4444
//use filter method to process value
4545
String description = Extractors.on(baseHtml).extract(selector("div.description")).filter(value -> value.toLowerCase()).asString();
46-
String year = Extractors.on("<div> Talk is cheap. Show me the code. - Fri, 25 Aug 2000 </div>").extract(selector("div")).filter(value -> value.trim()).with(regex("20\\d{2}")).filter(value -> "from " + value).asString();
46+
String year = Extractors.on("<div> Talk is cheap. Show me the code. - Fri, 25 Aug 2000 </div>")
47+
.extract(selector("div")) // extract with selector
48+
.filter(value -> value.trim()) // trim result
49+
.with(regex("20\\d{2}")) // get year with regex
50+
.filter(value -> "from " + value) // append 'form' string
51+
.asString();
4752
Assert.assertEquals("fivesmallq", title);
4853
Assert.assertEquals("29671", followers);
4954
Assert.assertEquals("talk is cheap. show me the code.", description);

0 commit comments

Comments
 (0)