Fix new tests and make TestLWN work
[gofetch.git] / src / be / nikiroo / gofetch / test / TestLWN.java
CommitLineData
a71d4075
NR
1package be.nikiroo.gofetch.test;
2
3import java.io.File;
4import java.io.IOException;
5import java.io.InputStream;
6import java.net.MalformedURLException;
7import java.net.URL;
8import java.util.HashMap;
9import java.util.Map;
10
11import be.nikiroo.gofetch.support.LWN;
12import be.nikiroo.gofetch.support.Type;
13
14public class TestLWN extends TestBase {
15
16 static private Map<URL, File> getMap() throws MalformedURLException {
17 Map<URL, File> map = new HashMap<URL, File>();
1aaa6ba3
NR
18
19 map.put(new URL("https://lwn.net/"), new File("index.html"));
20
21 map.put(new URL("https://lwn.net/Articles/763252/"), new File(
22 "Articles/763252.html"));
23 map.put(new URL("https://lwn.net/Articles/763987/"), new File(
24 "Articles/763987.html"));
25 map.put(new URL("https://lwn.net/Articles/764046"), new File(
26 "Articles/764046.html"));
27 map.put(new URL("https://lwn.net/Articles/764055"), new File(
28 "Articles/764055.html"));
29 map.put(new URL("https://lwn.net/Articles/764130"), new File(
30 "Articles/764130.html"));
31 map.put(new URL("https://lwn.net/Articles/764182"), new File(
32 "Articles/764182.html"));
33 map.put(new URL("https://lwn.net/Articles/764184/"), new File(
34 "Articles/764184.html"));
35 map.put(new URL("https://lwn.net/Articles/764202/"), new File(
36 "Articles/764202.html"));
37 map.put(new URL("https://lwn.net/Articles/764219"), new File(
38 "Articles/764219.html"));
39 map.put(new URL("https://lwn.net/Articles/764300"), new File(
40 "Articles/764300.html"));
41 map.put(new URL("https://lwn.net/Articles/764321/"), new File(
42 "Articles/764321.html"));
43
a71d4075
NR
44 return map;
45 }
46
47 public TestLWN(String[] args) {
48 super(new LWN() {
49 @Override
50 protected InputStream open(URL url) throws IOException {
1aaa6ba3 51 return doOpen(this, getMap(), url);
a71d4075
NR
52 }
53
54 @Override
55 public Type getType() {
56 return Type.LWN;
57 }
58 }, args);
59 }
60}