### Question:
MapFileReader extends Reader { public Map<String, String> readMap() throws IOException { Map<String, String> mapping = new HashMap<String, String>(); String line = reader.readLine(); while (line != null) { String[] keyValue = line.split("="); String key = keyValue[0]; String value = keyValue[1]; mapping.put(key, value); line = reader.readLine(); } return mapping; } MapFileReader(BufferedReader reader); Map<String, String> readMap(); @Override void close(); @Override int read(char[] cbuf, int off, int len);  }### Answer:
@Test public void testReadMap() throws Exception{ expect(reader.readLine()).andReturn(LINE_1); expect(reader.readLine()).andReturn(LINE_2); expect(reader.readLine()).andReturn(LINE_3); expect(reader.readLine()).andReturn(null); replay(reader); Map<String, String> map = mapFileReader.readMap(); verify(reader); assertEquals("id1", map.get("term1")); assertEquals("id2", map.get("term2")); assertEquals("id3", map.get("term3")); }