### Question:
WatchesSummary { public Map<String, Object> toMap() { Map<String, Object> summary = new LinkedHashMap<String, Object>(); summary.put(KEY_NUM_CONNECTIONS, numConnections); summary.put(KEY_NUM_PATHS, numPaths); summary.put(KEY_NUM_TOTAL_WATCHES, totalWatches); return summary; } WatchesSummary(int numConnections, int numPaths, int totalWatches); int getNumConnections(); int getNumPaths(); int getTotalWatches(); Map<String, Object> toMap(); static final String KEY_NUM_CONNECTIONS; static final String KEY_NUM_PATHS; static final String KEY_NUM_TOTAL_WATCHES; }### Answer:
@Test public void testToMap() { Map<String, Object> m = s.toMap(); assertEquals(3, m.size()); assertEquals(Integer.valueOf(1), m.get(WatchesSummary.KEY_NUM_CONNECTIONS)); assertEquals(Integer.valueOf(2), m.get(WatchesSummary.KEY_NUM_PATHS)); assertEquals(Integer.valueOf(3), m.get(WatchesSummary.KEY_NUM_TOTAL_WATCHES)); }