### Question:
ObjectManager implements LifecycleAspect { public ObjectTypeEntity saveObjectType(ObjectTypeEntity type) { if (type == null) return null; ObjectTypeEntity existing = getObjectType(type.getName()); if (existing != null && !Objects.equals(existing.getId(), type.getId()) && Objects.equals(existing.getName(), type.getName())) { throw new IllegalArgumentException(String.format("ObjectType with name = %s already exists.", type.getName())); } objectTypeDao.save(type); objectTypeByIdCache.invalidate(type.getId()); objectTypeByNameCache.invalidate(type.getName()); return type; } @Inject  ObjectManager(ClusterManager clusterManager); @Override void startComponent(); @Override void stopComponent(); ObjectTypeEntity getObjectType(UUID id); ObjectTypeEntity getObjectType(String name); List<ObjectTypeEntity> fetchObjectTypes(); ObjectTypeEntity saveObjectType(ObjectTypeEntity type); ObjectEntity getObject(UUID id); ObjectEntity getObject(String type, String value); Iterator<ObjectEntity> getObjects(List<UUID> id); ObjectEntity saveObject(ObjectEntity object); Iterator<ObjectFactBindingEntity> fetchObjectFactBindings(UUID id); ObjectFactBindingEntity saveObjectFactBinding(ObjectFactBindingEntity binding);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testSaveObjectTypeWithSameNameThrowsException() { getObjectManager().saveObjectType(createObjectType("objectType")); getObjectManager().saveObjectType(createObjectType("objectType")); }
@Test public void testSaveObjectTypeReturnsSameEntity() { ObjectTypeEntity entity = createObjectType(); assertSame(entity, getObjectManager().saveObjectType(entity)); }
@Test public void testSaveObjectTypeReturnsNullOnNullInput() { assertNull(getObjectManager().saveObjectType(null)); }