### Question:
TCSObjectPool { public void addObject(TCSObject<?> newObject) throws ObjectExistsException { requireNonNull(newObject, "newObject"); if (objectsByName.containsKey(newObject.getName())) { throw new ObjectExistsException("Object name " + newObject.getName() + " already exists."); } objectsByName.put(newObject.getName(), newObject); idBits.set(extractId(newObject.getReference())); objectNameGenerator.addString(newObject.getName()); } @Inject  TCSObjectPool(@ApplicationEventBus EventHandler eventHandler); void addObject(TCSObject<?> newObject); E replaceObject(E object); @Nullable TCSObject<?> getObjectOrNull(TCSObjectReference<?> ref); @Nonnull TCSObject<?> getObject(TCSObjectReference<?> ref); @Nullable T getObjectOrNull(Class<T> clazz, TCSObjectReference<T> ref); @Nonnull T getObject(Class<T> clazz, TCSObjectReference<T> ref); @Nullable TCSObject<?> getObjectOrNull(String name); @Nonnull TCSObject<?> getObject(String name); @Nullable T getObjectOrNull(Class<T> clazz, String name); @Nonnull T getObject(Class<T> clazz, String name); Set<TCSObject<?>> getObjects(Pattern regexp); Set<T> getObjects(Class<T> clazz); Set<T> getObjects(Class<T> clazz, Pattern regexp); Set<T> getObjects(@Nonnull Class<T> clazz,
                                                    @Nonnull Predicate<? super T> predicate); @Deprecated void renameObject(TCSObjectReference<?> ref, String newName); boolean contains(String objectName); TCSObject<?> removeObject(TCSObjectReference<?> ref); Set<TCSObject<?>> removeObjects(Set<String> objectNames); @SuppressWarnings("deprecation") void setObjectProperty(TCSObjectReference<?> ref, String key, String value); @SuppressWarnings("deprecation") void clearObjectProperties(TCSObjectReference<?> ref); int size(); boolean isEmpty(); @Deprecated @ScheduledApiChange(when = "5.0") String getUniqueObjectName(String prefix, String suffixPattern); @Deprecated @ScheduledApiChange(when = "5.0") int getUniqueObjectId(); void emitObjectEvent(TCSObject<?> currentObjectState,
                              TCSObject<?> previousObjectState,
                              TCSObjectEvent.Type evtType);  }### Answer:
@Test(expected = ObjectExistsException.class) public void shouldThrowIfAddingExistingName() { Point point1 = new Point("Point-00001"); pool.addObject(point1); Point point2 = new Point("Point-00002"); pool.addObject(point2); Path path1 = new Path("Path-00001", point1.getReference(), point2.getReference()); pool.addObject(path1); Path path2 = new Path("Path-00002", point2.getReference(), point1.getReference()); pool.addObject(path2); pool.addObject(new Point("Path-00002")); }