### Question:
Document implements Map<String, Object>, Bson { @Override public boolean equals(Object o) { if (o == null) { return false; } if (o == this) { return true; } if (!(o instanceof Document)) { return false; } List<String> keys = new ArrayList<>(keySet()); List<String> otherKeys = new ArrayList<>(((Document) o).keySet()); if (!keys.equals(otherKeys)) { return false; } return documentAsMap.equals(o); } Document();  Document(String key, Object value);  Document(Map<String, ?> map); void cloneInto(Document targetDocument); Document cloneDeeply(); Document append(String key, Object value); Document appendAll(Map<String, Object> map); @Override boolean containsValue(Object value); @Override Object get(Object key); Object getOrMissing(Object key); @Override void clear(); @Override int size(); @Override boolean isEmpty(); @Override boolean containsKey(Object key); @Override Object put(String key, Object value); void putIfNotNull(String key, Object value); @Override void putAll(Map<? extends String, ?> m); @Override Object remove(Object key); @Override @SuppressWarnings("unchecked") Document clone(); @Override Set<String> keySet(); @Override Collection<Object> values(); @Override Set<Entry<String, Object>> entrySet(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); String toString(boolean compactKey); String toString(boolean compactKey, String prefix, String suffix);  }### Answer:
@Test void testEquals() throws Exception { assertThat(new Document()).isNotEqualTo(Collections.emptyMap()); assertThat(new Document()).isNotEqualTo(null); assertThat(new Document()).isEqualTo(new Document()); assertThat(new Document().append("a", 1). append("b", 1)).isEqualTo(new Document().append("a", 1).append("b", 1)); assertThat(new Document().append("a", 1). append("b", 1)).isNotEqualTo(new Document().append("b", 1).append("a", 1)); }