### Question:
ObjectManager implements LifecycleAspect { public ObjectEntity getObject(UUID id) { if (id == null) return null; return objectDao.get(id); } @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 public void testSaveAndGetObject() { ObjectEntity object = createAndSaveObject(createAndSaveObjectType().getId()); assertObject(object, getObjectManager().getObject(object.getId())); }
@Test public void testGetObjectWithNonExistingObject() { assertNull(getObjectManager().getObject(null)); assertNull(getObjectManager().getObject(UUID.randomUUID())); }
@Test public void testSaveAndGetObjectByTypeValue() { ObjectTypeEntity type = createAndSaveObjectType(); ObjectEntity object = createAndSaveObject(type.getId()); assertObject(object, getObjectManager().getObject(type.getName(), object.getValue())); }
@Test(expected = IllegalArgumentException.class) public void testGetObjectByTypeValueWithNonExistingObjectType() { ObjectEntity entity = createAndSaveObject(createAndSaveObjectType().getId()); getObjectManager().getObject("nonExisting", entity.getValue()); }
@Test public void testGetObjectByTypeValueWithNonExistingObjectValue() { ObjectTypeEntity entity = createAndSaveObjectType(); assertNull(getObjectManager().getObject(entity.getName(), "nonExisting")); }
@Test public void testGetObjectByTypeValueReturnsNullOnNullInput() { assertNull(getObjectManager().getObject(null, "ignored")); assertNull(getObjectManager().getObject("", "ignored")); assertNull(getObjectManager().getObject("ignored", null)); assertNull(getObjectManager().getObject("ignored", "")); }