| 1 | package be.nikiroo.gofetch.test; |
| 2 | |
| 3 | import java.io.File; |
| 4 | import java.io.IOException; |
| 5 | import java.io.InputStream; |
| 6 | import java.net.MalformedURLException; |
| 7 | import java.net.URL; |
| 8 | import java.util.HashMap; |
| 9 | import java.util.Map; |
| 10 | |
| 11 | import be.nikiroo.gofetch.support.LWN; |
| 12 | import be.nikiroo.gofetch.support.Type; |
| 13 | |
| 14 | public class TestLWN extends TestBase { |
| 15 | |
| 16 | static private Map<URL, File> getMap() throws MalformedURLException { |
| 17 | Map<URL, File> map = new HashMap<URL, File>(); |
| 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 | |
| 44 | return map; |
| 45 | } |
| 46 | |
| 47 | public TestLWN(String[] args) { |
| 48 | super(new LWN() { |
| 49 | @Override |
| 50 | protected InputStream open(URL url) throws IOException { |
| 51 | return doOpen(this, getMap(), url); |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public Type getType() { |
| 56 | return Type.LWN; |
| 57 | } |
| 58 | }, args); |
| 59 | } |
| 60 | } |