### Question:
ObjectResponseConverter implements Function<ObjectRecord, Object> { @Override public Object apply(ObjectRecord record) { if (record == null) return null; return Object.builder() .setId(record.getId()) .setType(ObjectUtils.ifNotNull(objectTypeConverter.apply(record.getTypeID()), ObjectType::toInfo)) .setValue(record.getValue()) .setStatistics(resolveStatistics(record)) .build(); } @Inject  ObjectResponseConverter(ObjectTypeByIdResponseResolver objectTypeConverter,
                                 FactTypeByIdResponseResolver factTypeConverter,
                                 Function<UUID, Collection<ObjectStatisticsContainer.FactStatistic>> factStatisticsResolver); @Override Object apply(ObjectRecord record);  }### Answer:
@Test public void testConvertNull() { assertNull(converter.apply(null)); }
@Test public void testConvertEmpty() { assertNotNull(converter.apply(new ObjectRecord())); }
@Test public void testConvertWithoutStatistics() { ObjectRecord record = createRecord(); assertModel(record, converter.apply(record)); }
@Test public void testConvertWithStatistics() { ObjectResponseConverter converter = new ObjectResponseConverter(objectTypeConverter, factTypeConverter, id -> Collections.singleton(new ObjectStatisticsContainer.FactStatistic(UUID.randomUUID(), 42, 123456789, 987654321))); ObjectRecord record = createRecord(); Object model = converter.apply(record); assertModel(record, model); assertEquals(1, model.getStatistics().size()); assertNotNull(model.getStatistics().get(0).getType()); assertEquals(42, model.getStatistics().get(0).getCount()); assertEquals(123456789, (long) model.getStatistics().get(0).getLastAddedTimestamp()); assertEquals(987654321, (long) model.getStatistics().get(0).getLastSeenTimestamp()); }