urls = new ArrayList<>();
181 | while (res.hasNext()) {
182 | String url = res.next().get("col").toString();
183 | urls.add(url);
184 | }
185 | assertEquals(Arrays.asList("https://www.google" +
186 | ".hu/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png"), urls);
187 | }
188 |
189 | private String getTestHtml() {
190 | StringBuilder contentBuilder = new StringBuilder();
191 | try {
192 | BufferedReader in = new BufferedReader(new FileReader(
193 | "src/test/resources/test.html"));
194 | String str;
195 | while ((str = in.readLine()) != null) {
196 | contentBuilder.append(str);
197 | }
198 | in.close();
199 | } catch (IOException e) {
200 | e.printStackTrace();
201 | }
202 | return contentBuilder.toString();
203 | }
204 | }
205 |
--------------------------------------------------------------------------------
/src/test/resources/test.html:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 | HTML Test Page
9 |
10 |
11 |
12 | Testing display of HTML elements
13 | This is 2nd level heading
14 | This is a test paragraph.
15 | This is 3rd level heading
16 | This is a test paragraph.
17 | This is 4th level heading
18 | This is a test paragraph.
19 | This is 5th level heading
20 | This is a test paragraph.
21 | This is 6th level heading
22 | This is a normal paragraph
23 | Links
24 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------