### Question:
Facts implements Iterable<Fact<?>> { public Map<String, Object> asMap() { Map<String, Object> map = new HashMap<>(); for (Fact<?> fact : facts) { map.put(fact.getName(), fact.getValue()); } return map; }  void put(String name, T value); void add(Fact<T> fact); void remove(String factName); void remove(Fact<T> fact); @SuppressWarnings("unchecked") T get(String factName); Fact<?> getFact(String factName); Map<String, Object> asMap(); @Override Iterator<Fact<?>> iterator(); void clear(); @Override String toString();  }### Answer:
@Test public void testAsMap() { Fact<Integer> fact1 = new Fact<>("foo", 1); Fact<Integer> fact2 = new Fact<>("bar", 2); facts.add(fact1); facts.add(fact2); Map<String, Object> map = facts.asMap(); assertThat(map).containsKeys("foo", "bar"); assertThat(map).containsValues(1, 2); }