### Question:
ComponentCollision implements ComponentUpdater, HandlerListener, TransformableListener { @Override public void update(double extrp, Handlables objects) { done.clear(); for (final Map<Point, Set<Collidable>> groups : collidables.values()) { for (final Entry<Point, Set<Collidable>> current : groups.entrySet()) { checkGroup(current); } } for (final Collided collided : toNotify) { collided.collidableA.notifyCollided(collided.collidableB, collided.with, collided.by); } toNotify.clear(); } ComponentCollision(); Collection<Collidable> getInside(Area area); @Override void update(double extrp, Handlables objects); @Override void notifyHandlableAdded(Featurable featurable); @Override void notifyHandlableRemoved(Featurable featurable); @Override void notifyTransformed(Transformable transformable);  }### Answer:
@Test void testCollidable() { transformable1.teleport(1.0, 2.0); transformable2.teleport(1.0, 1.0); handler.update(1.0); assertEquals(collidable1, collide.get()); assertEquals(collidable2, featurable1.called.get()); collide.set(null); featurable1.called.set(null); transformable1.teleport(ComponentCollision.REDUCE_FACTOR, ComponentCollision.REDUCE_FACTOR); handler.update(1.0); assertNull(collide.get()); assertNull(featurable1.called.get()); }
@Test void testCollidableTwoPoints() { transformable1.teleport(ComponentCollision.REDUCE_FACTOR - 3.0, 0.0); transformable2.teleport(ComponentCollision.REDUCE_FACTOR - 1.0, 0.0); final AtomicInteger count = new AtomicInteger(); collidable2.addListener((c, w, b) -> count.incrementAndGet()); handler.update(1.0); assertEquals(1, count.get()); }
@Test void testCollidablesRemovePoints() { transformable1.teleport(0.0, 0.0); transformable2.teleport(0.0, 0.0); handler.update(1.0); assertEquals(collidable1, collide.get()); assertEquals(collidable2, featurable1.called.get()); collide.set(null); featurable1.called.set(null); transformable1.teleport(ComponentCollision.REDUCE_FACTOR, ComponentCollision.REDUCE_FACTOR); handler.update(1.0); assertNull(collide.get()); assertNull(featurable1.called.get()); transformable2.teleport(ComponentCollision.REDUCE_FACTOR, ComponentCollision.REDUCE_FACTOR); handler.update(1.0); assertEquals(collidable1, collide.get()); assertEquals(collidable2, featurable1.called.get()); }
@Test void testRemoved() { transformable1.teleport(1.0, 2.0); transformable2.teleport(2.0, 3.0); handler.update(1.0); assertEquals(collidable1, collide.get()); assertEquals(collidable2, featurable1.called.get()); collide.set(null); featurable1.called.set(null); handler.remove(featurable1); handler.update(1.0); assertNull(collide.get()); assertNull(featurable1.called.get()); handler.remove(featurable2); handler.remove(nonCollidable); handler.update(1.0); assertNull(collide.get()); assertNull(featurable1.called.get()); }