File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
src/test/java/org/jsoup/parser Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 17
17
import java .util .List ;
18
18
19
19
import static org .jsoup .nodes .Document .OutputSettings .Syntax ;
20
- import static org .junit .Assert .assertEquals ;
21
- import static org .junit .Assert .assertNotSame ;
20
+ import static org .junit .Assert .*;
22
21
23
22
/**
24
23
* Tests XmlTreeBuilder.
@@ -70,13 +69,16 @@ public void testSupplyParserToConnection() throws IOException {
70
69
71
70
// parse with both xml and html parser, ensure different
72
71
Document xmlDoc = Jsoup .connect (xmlUrl ).parser (Parser .xmlParser ()).get ();
73
- Document htmlDoc = Jsoup .connect (xmlUrl ).get ();
72
+ Document htmlDoc = Jsoup .connect (xmlUrl ).parser (Parser .htmlParser ()).get ();
73
+ Document autoXmlDoc = Jsoup .connect (xmlUrl ).get (); // check connection auto detects xml, uses xml parser
74
74
75
75
assertEquals ("<doc><val>One<val>Two</val>Three</val></doc>" ,
76
76
TextUtil .stripNewlines (xmlDoc .html ()));
77
- assertNotSame (htmlDoc , xmlDoc );
77
+ assertFalse (htmlDoc .equals (xmlDoc ));
78
+ assertEquals (xmlDoc , autoXmlDoc );
78
79
assertEquals (1 , htmlDoc .select ("head" ).size ()); // html parser normalises
79
80
assertEquals (0 , xmlDoc .select ("head" ).size ()); // xml parser does not
81
+ assertEquals (0 , autoXmlDoc .select ("head" ).size ()); // xml parser does not
80
82
}
81
83
82
84
@ Test
You can’t perform that action at this time.
0 commit comments