@Test public void shouldReturnEmptyOptionalForUnknownId() { UUID unknownId = UUID.randomUUID(); Optional<Object> object = cut.getById(unknownId); assertThat(object.isPresent()).isFalse(); }
public Optional<Object> getById(final UUID id) { return Optional.ofNullable(idToObject.get(id)); }
WeakObjectRegistry { public Optional<Object> getById(final UUID id) { return Optional.ofNullable(idToObject.get(id)); } }
WeakObjectRegistry { public Optional<Object> getById(final UUID id) { return Optional.ofNullable(idToObject.get(id)); }  }
WeakObjectRegistry { public Optional<Object> getById(final UUID id) { return Optional.ofNullable(idToObject.get(id)); }  Optional<Object> getById(final UUID id); Object getByIdOrFail(final UUID id); Optional<UUID> getId(final Object object); UUID getIdOrFail(final Object object); UUID registerIfUnknown(final Object object); void registerObject(final Object object, final UUID id); }
WeakObjectRegistry { public Optional<Object> getById(final UUID id) { return Optional.ofNullable(idToObject.get(id)); }  Optional<Object> getById(final UUID id); Object getByIdOrFail(final UUID id); Optional<UUID> getId(final Object object); UUID getIdOrFail(final Object object); UUID registerIfUnknown(final Object object); void registerObject(final Object object, final UUID id);  }