### Question:
Change { public static <T extends Entity> Map<Long, Change<T>> changesToMap(Collection<Change<T>> changes) { Map<Long, Change<T>> result = new HashMap<>(); for (Change<T> change : changes) { long id = change.getPrevious().getId(); if (id != change.getCurrent().getId()) { throw new IllegalArgumentException("IDs of the Entities in Change do not match!"); } result.put(id, change); } return result; } Change(T previous, T current); T getPrevious(); T getCurrent(); @SuppressWarnings("RedundantIfStatement") @Override boolean equals(Object o); @Override int hashCode(); static Map<Long, Change<T>> changesToMap(Collection<Change<T>> changes);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void invalidChangeShouldThrowException() { try (Transaction tx = database.beginTx()) { Change<Node> nodeChange1 = new Change<>(database.getNodeById(0), database.getNodeById(1)); changesToMap(Collections.singleton(nodeChange1)); } }