### Question:
WikidataLinkMap implements Serializable { public String title2Data(String in) { in = in.replaceAll("\\[\\[([^\\|]+)\\|?(.*?)\\]\\]", "$1").trim().toLowerCase(); if (map.containsKey(in)) { return map.get(in); } else { in = in.replaceAll("('s|\\(.*?\\))", "").trim(); } return map.get(in.trim().toLowerCase()); } WikidataLinkMap(String fn);  WikidataLinkMap(String fn, boolean unique); String title2Data(String in); boolean writeFile(String fn);  }### Answer:
@Test public void testTitle2Data() throws Exception { Map<String, String> testcases = new HashMap<>(); testcases.put("[[complex number|complex]]", "Q11567"); testcases.put("[[complex conjugate]]", "Q381040"); testcases.put("[[partial derivative]]", "Q186475"); testcases.put("[[Schrödinger's equation]]", "Q165498"); testcases.put("[[Hamiltonian mechanics]]", "Q477921"); testcases.put("[[Operator (physics)]]", "Q2597952"); testcases.put("[[Quantum state]]", "Q230883"); testcases.put("[[Linear algebra]]", "Q852571"); testcases.put("[[Conservation of energy]]", "Q11382"); testcases.put("[[Potential theory]]", "Q1154848"); testcases.put("[[Many-body problem]]", "Q617316"); testcases.put("[[Electrostatics]]", "Q26336"); testcases.put("[[Electric field]]", "Q46221"); testcases.put("[[Magnetic field]]", "Q11480"); WikidataLinkMap map = new WikidataLinkMap(getClass().getResource("title2Data.csv").getFile(), false); for (Map.Entry<String, String> entry : testcases.entrySet()) { assertEquals("Test for " + entry.getKey(), entry.getValue(), map.title2Data(entry.getKey())); } }